- Feature Name: liftoff
- Start Date: 2016-02-15
- RFC PR: gruntjs/grunt-cli#117
- Grunt Issue: (leave this empty)
Implement Liftoff for the CLI so Gruntfiles can be written in the language of the user's choice without needing to register each of them directly into Grunt.
- Let users define their Gruntfile in a language or their choice.
- Let users specify v8 flags.
- Removes dependencies (
coffee-script
) and code from core Grunt.
Replace the CLI with:
var Liftoff = require('liftoff');
var v8flags = require('v8flags');
var argv = require('minimist')(process.argv.slice(2));
v8flags(function (err, v8flags) {
var Grunt = new Liftoff({
name: 'grunt',
// Support a number of languages based on file extension
extensions: require('interpret').jsVariants,
// Flags that are v8 flags will be loaded into node instead of Gruntfile
v8flags: v8flags
});
Grunt.launch({
cwd: argv.cwd,
configPath: argv.gruntfile,
require: argv.require,
completion: argv.completion,
verbose: argv.verbose
}, function (env) {
// Load Gruntfile
});
});
This will support Gruntfiles in a number of languages, including CoffeeScript, Babel, TypeScript, LiveScript, JSX and many more: https://github.com/js-cli/js-interpret/blob/master/index.js#L96
An example if a user wishes to use Babel:
npm install babel-core babel-preset-es2015 --save-dev
Then create a .babelrc
file with the preset and a Gruntfile.babel.js
. Then
the Gruntfile will use babel and the specified presets.
If a language is not natively supported a user can do:
npm install custom-lang
grunt --require custom-lang/register
The current known Grunt options are: https://github.com/gruntjs/grunt-known-options
Takes away CLI options from users.
Only if implemented withargv
,process.env
might be an alternative if a problem.
- None known.
In doing this, which parts are not backwards compatible?
None known at this time.