nmiljkovic / gulp-requirejs-rev-replace

A gulp plugin to replace requirejs modules based on revision manifest.

Home Page:https://www.npmjs.com/package/gulp-requirejs-rev-replace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-requirejs-rev-replace

A gulp plugin to replace requirejs modules based on revision manifest.

Installation

Install package with NPM and add it to your development dependencies:

npm install gulp-requirejs-rev-replace --save-dev

Usage

You can generate your manifest with gulp-rev. When generating your requirejs config, use the manifest option and pass in the stream to your manifest(s).

gulp.src('path/to/config.js')
    .pipe(configRevReplace({
        manifest: gulp.src('path/to/manifest.json')
    }))
    .pipe(gulp.dest('dist/config.js'));

Given an example manifest:

{
  "vendor/raphael/raphael.button.js": "vendor/raphael/raphael-8e8859afcd.button.js",
  "vendor/raphael/raphael.curve.js": "vendor/raphael/raphael-0c24a27b6f.curve.js"
}

With the original require config:

require.config({
    'rabix-raphael.button': 'path/to/vendor/raphael/raphael.button',
    'rabix-raphael.curve': 'path/to/vendor/raphael/raphael.curve',
});

It will generate the following config:

require.config({
    'rabix-raphael.button': 'path/to/vendor/raphael/raphael-8e8859afcd.button',
    'rabix-raphael.curve': 'path/to/vendor/raphael/raphael-0c24a27b6f.curve',
});

About

A gulp plugin to replace requirejs modules based on revision manifest.

https://www.npmjs.com/package/gulp-requirejs-rev-replace

License:MIT License


Languages

Language:JavaScript 100.0%