tsmckelvey / gulp-lodash-builder

A tool to create a custom Lodash File

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-lodash-builder

A tool to create a customised version of lodash. Automatically looks for references to lodash in your code and gathers the required methods in a bundled file.

Usage

Install gulp-lodash-builder as a development dependency:

$ npm install --save-dev gulp-lodash-builder

Then, add it to your gulpfile.js:

Gulp Example

var gulp = require('gulp');
var lodashBuilder = require('gulp-lodash-builder');

var options = {
  target: "/assets/javascript/vendor/lodash.custom.js",
  ensure: ['startsWith','each','map'], // Ensures these methods are required BESIDES the references that exist in your code.
  settings: {}
};
gulp.task('lodash', function (cb) {
  return gulp.src("/path/to/javascript/**", {buffer: false}) //gulp-lodash-builder will look for lodash methods here
    .pipe(lodashBuilder(options))
    .on('error', function (err) {
      console.log('err: ', err)
    })
});

About

A tool to create a custom Lodash File

License:MIT License


Languages

Language:JavaScript 100.0%