Grunt configuration with es6

You can write grunt configuration files in es6 as follows:

//Gruntfile.js module.exports = function (grunt) { var arr = [1,2,3]; arr.forEach(val => { ... }); ... } 
+6
source share
2 answers

One possible way to do this painlessly is to use the Babel babel-register module as follows:

Installation:

npm install babel-register --save-dev

.babelrc:

 { presets: ["es2015"] } 

Gruntfile.js:

 require('babel-register') module.exports = require('./Gruntfile.es').default 

Gruntfile.es

 export default function(grunt) { grunt.initConfig({}) } 
+2
source

GruntJS is a javascript based application. It works as part of the node / iojs process and adheres to the capabilities of this environment. If you are using a version of iojs or node that supports these features, then yes, it is possible.

0
source

All Articles