ES6 introduced a lot of new syntax features, but want to do in the existing browser environment, need to ES6 code to ES5 code, there are many transcoding babel,traceur, etc., after reference, use Traceur and gulp to build ES6 environment, start my ES6 .Start installation
First make sure the Nodejs is installed on your computer.
1. Create a project directory
2. Global installation traceur, in console input
NPM install-g traceur
3. Open the project directory, install the Gulp and the Gulp-traceur plugin
NPM Install-g Gulp
NPM Install Gulp Gulp-traceur–save-dev
4. Create the Package.json file NPM init, create the gulpfile.js in the project root directory
var gulp = require (' gulp '); var browsersync = require (' Browser-sync '). Create (); var traceur = require (' gulp-traceur ');// Static Server + watching scss/html filesgulp.task (' Serve ', [' traceur '], function () { browsersync.init ({ Server : "./" }); Gulp.watch ("Build/**/*.js", [' traceur ');}); Gulp.task (' Traceur ', function () { return gulp.src (' Build/*.js ') . Pipe (Traceur ({exprimental:true})) . Pipe (gulp.dest (' JS ');}); Gulp.task (' Default ', [' serve ']);
5. Run gulp, when the content in the build folder written with ES6 syntax changes, the Traceur task executes and uses Browser-sync to make the browser respond to file changes in real time (HTML, JS, CSS, SASS, Less) and automatically refresh the page.
6. Start the use of ES6.
Reference articles
Several ways to use ES6 in 1.WebStorm (http://www.cnblogs.com/darrenji/p/4997045.html)
2.browser-sync (http://www.browsersync.cn/).
Use Gulp to build ES6 operating environment