Skip to content

parroit/gulp-pure-cjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-pure-cjs

Gulp plugin for pure-cjs

NPM version

Getting Started

  1. Install the module with: npm install gulp-pure-cjs --save-dev

  2. Add a task to your Gulpfile.js:

var pure = require('gulp-pure-cjs');

gulp.task('build', function() {
  
    return gulp.src('./lib/index.js')
        .pipe(pure({
            exports: 'my-exported-module'
        }))
        .pipe(gulp.dest('dist'));
});

Beware!

pure-cjs always re-read files from disk, so if you load other plugin in pipeline that changes file content, this changes will be lost!

Sourcemaps

In order to produce sourcemaps, you have to use gulp-sourcemaps plugin. This allow source modification info to be preserved through your pipeline, from where you call sourcemaps.init to where you call sourcemaps.write. See gulp-sourcemaps project for more info about out it works.

var sourcemaps = require('gulp-sourcemaps');

...

return gulp.src('./test/example_test.js')
        .pipe(sourcemaps.init())
...
        .pipe(pure())
...
        .pipe(sourcemaps.write('.'))
...

Options

The options object you use to call the plugin is passed to pure-cjs transform method with some change:

  • dryRun is always set to true, in order to disable pure-cjs output file save
  • input is overwritten with filename received from gulp pipeline

For documentation on all other options available, see pure-cjs repo

Other stuff

  • documentation - maybe I will add documentation if you ask it. Open an issue for this.
  • support - open an issue here.

License

MIT © 2014, Andrea Parodi

About

Gulp plugin for Pure CommonJS builder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published