首页 > 代码库 > [ES6] 02. Traceur compiler and Grunt

[ES6] 02. Traceur compiler and Grunt

There are two ways to compiler the ES6 fils to Javascript file.

One:

traceur --out build/app.js --script js/app.js --experimental

Two:

Using grunt. 

Install:


 

npm install -g traceurnpm install grunt-contrib-watchnpm install grunt-traceur-latest

GruntFile:

module.exports = function(grunt){    grunt.initConfig({        traceur: {            options: {                experimental:true            },            custom: {                files:{                    ‘build/app.js‘: "js/**/*.js"                }            }        },        watch: {            files:"js/**/*.js",            tasks: "traceur"        }    });    grunt.loadNpmTasks(‘grunt-traceur-latest‘);    grunt.loadNpmTasks(‘grunt-contrib-watch‘);}

 

[ES6] 02. Traceur compiler and Grunt