码迷,mamicode.com
首页 > 其他好文 > 详细

[ES6] 02. Traceur compiler and Grunt

时间:2014-11-18 00:04:43      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   ar   sp   java   strong   div   

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 traceur
npm install grunt-contrib-watch
npm 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

标签:style   blog   io   color   ar   sp   java   strong   div   

原文地址:http://www.cnblogs.com/Answer1215/p/4104620.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!