run npm commands (like install or update) from grunt.
-
Usage (see further down this page)
-
Developers
This guide assumes, that you are familiar with the use of
npm and
grunt.
The plugin can be installed by the following command:
npm install grunt-call-rollup --save-dev
Once installed, the plugin may be loaded from within your gruntfile:
grunt.loadNpmTasks( "grunt-call-rollup" );
Setup the task configuration as described below (see usage) and run the task:
grunt call_rollup
Of cause, the task can be integrated into any complex build process.
The following examples assume that the grunt plugin 'load-grunt-config' is used. Alternatively, the code can of course be integrated into the 'gruntfile.js' file.
// file call_rollup.js
module.exports = function ( grunt, options ) {
return {
options: {
config: ".conf/rollup.config.json" // path to rollup configuration file
// 'config' is [required!] in either 'options' or a 'build target'
},
always: { // target 'always' of grunt multitask 'call_rollup'
dryrun: true, // outputs rollup options but does not run rollup
override: { // [optional!] a full or partial rollup configuration which
// overrides the values found in the config rollup file
}
}
};
};For 'rollup <command>' and matching command line arguments see npm Docs