0.1.2 • Published 6 years ago

rolldash v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Rolldash (Node 8+)

npm

This module uses rollup to create a selectively minified build of lodash using npm scripts. This package was made in response to the deprecation of the official lodash-cli utility.

Usage

Installation

npm-script

npm i -D rolldash

CLI usage (npm-script)

rolldash [-v --version <latest|'4.0.0'>] [-c --config <path|'./rolldash.config.js'>] -o --output <path>

The above (as either an npm script) will do the following

  1. Fetches a local copy of Lodash of the specified version
  2. Reads the configuration file containing the regex/string names of valid Lodash exports
  3. The build script dynamically generates a build script in memory and uses it to build a selectively exported version of Lodash locally to the specified output location.

Example

rolldash -v 4.0.1 ./build/lodash.js

The above will fetch version 4.0.1 of Lodash, use rolldash.config.js in the current working directory, and output the file to ./build/lodash.js relative to the current working directory.

Configuration

The configuration file used by the build tool is specified by a simple module export of an object containing use with allows for both strings and regular expressions.

Example configuration file

module.exports = {
	compressor: {
		// uglifyJS2 settings
	},
	use: [
		'map',
		/difference/,
	],
};

The above will match any Lodash exports exactly named map, and any exports containing the word difference. The build script will output the detected exports when run.