gulp-ember-rocks-traceur
v0.0.1
Published
A Gulp plugin. Compile ES6 script on the fly using traceur-compiler for ember-rocks
Downloads
2
Maintainers
Readme
gulp-ember-rocks-traceur
Preprocessor to compile ES6 JavaScript on the fly using traceur-compiler for ember-rocks.
Install
$ npm install --save-dev gulp-ember-rocks-traceur
Usage
var gulp = require('gulp');
var traceur = require('gulp-ember-rocks-traceur');
gulp.task('default', function () {
return gulp.src('src/app.js')
.pipe(traceur({modules: 'amd'}))
.pipe(gulp.dest('dist'));
});
API
traceur(options)
Options are passed through to Traceur, except for options.filename
which is set for you.
options
modules
Type: string
Default: amd
Values: amd, commonjs, instantiate, inline, register
By default, gulp-ember-rocks-traceur treats all files as modules. This allows use of the export
, module
and import
syntax. In this way the transformer can be used to compile ES6 for AMD or Node.js environments.
Source Maps
Use gulp-sourcemaps like this:
var gulp = require('gulp');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var emberRocksTraceur = require('gulp-ember-rocks-traceur');
gulp.task('default', function () {
return gulp.src('src/*.js')
.pipe(sourcemaps.init())
.pipe(emberRocksTraceur())
.pipe(concat('all.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});