New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

express-rev

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-rev

Middleware which adds helper functions for dealing with manifest files and file fingerprints.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

express-rev

Middleware which adds helper functions for dealing with manifest files and file fingerprints.

Setup

Configure your ExpressJS project based on the example below. Include this middleware before rendering a view.

// index.js (example ExpressJS application)

var express = require('express');
var manifest = require('express-rev');
var app = express();

app.set('views', './views');
app.set('view engine', 'jade');

app.use(rev({
  manifest: './public/assets/manifest.json',
  prepend: '/assets'
}));
app.use('/', express.static('./public'));

app.get('/', function (req, res) {
  res.render('index');
});

module.exports = app;

Now you can use rev function in your views to print file path.

// index.jade (example jade view)

doctype html
html(lang='en')
  head
    title Asset Fingerprint Example
    link(rel='stylesheet', type='text/css', href=assetPath('index.css'))
    script(type='text/javascript', src='assetPath(index.js'))
  body
    img(src=assetPath('logo.png'))

Now all you need is a good asset-pipeline module. Use gulp with gulp-devkit for that.

Config

Open defaults.json file to see the default configuration values.

manifest: String

Path to JSON manifest file (e.g this file will generate the gulp-rev-all plugin). Manifest replace-process is ignored if the file does not exist.

prepend: String

URL path where static route for assets should be mounted.

Keywords

express

FAQs

Package last updated on 03 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts