grunt-call-rollup
v1.0.0
Published
run rollup bundler from grunt
Readme
grunt-call-rollup
Integrate Rollup builds directly into Grunt processes using the Rollup JavaScript API.
Content
Usage (see further down this page)
Developers
Getting started
This guide assumes that you are familiar with the use of
npm and
grunt.
The plugin can be installed using the following command:
npm install grunt-call-rollup --save-devOnce installed, the plugin can be loaded from within your Gruntfile:
grunt.loadNpmTasks("grunt-call-rollup");Set up the task configuration as described below (see usage) and run the task:
grunt call_rollupOf course, the task can be integrated into any complex build process.
Usage
The following examples assume that the Grunt plugin load-grunt-config is used.
Alternatively, the configuration can be integrated directly into the gruntfile.js.
// 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 Rollup config file
}
}
};
};How the task works
grunt-call-rollup does not invoke Rollup via the command line, npx, or a binary from
node_modules/.bin. Instead, Rollup is executed directly using its JavaScript API.
This means:
- No shell execution is involved
- No dependency on a globally installed Rollup binary
- Full control over the Rollup configuration object at runtime
