Skip to content

Commit

Permalink
fix(gulp): use different transpile options for server and client
Browse files Browse the repository at this point in the history
for Grunt parity, the server code should be transpiled with with the
`runtime` option
  • Loading branch information
david-mohr committed Dec 20, 2015
1 parent 4a5e02b commit bb67961
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/templates/gulpfile.babel(gulp).js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ let styles = lazypipe()
.pipe(plugins.autoprefixer, {browsers: ['last 1 version']})
.pipe(plugins.sourcemaps.write, '.');<% if(filters.babel || filters.coffee) { %>

let transpile = lazypipe()
let transpileServer = lazypipe()
.pipe(plugins.sourcemaps.init)<% if(filters.babel) { %>
.pipe(plugins.babel, {
optional: ['runtime']
})<% } else { %>
.pipe(plugins.coffee, {bare: true})<% } %>
.pipe(plugins.sourcemaps.write, '.');

let transpileClient = lazypipe()
.pipe(plugins.sourcemaps.init)<% if(filters.babel) { %>
.pipe(plugins.babel, {
optional: ['es7.classProperties']
Expand Down Expand Up @@ -255,13 +263,13 @@ gulp.task('styles', () => {

gulp.task('transpile:client', () => {
return gulp.src(paths.client.scripts)
.pipe(transpile())
.pipe(transpileClient())
.pipe(gulp.dest('.tmp'));
});<% } %>

gulp.task('transpile:server', () => {
return gulp.src(_.union(paths.server.scripts, paths.server.json))
.pipe(transpile())
.pipe(transpileServer())
.pipe(gulp.dest(`${paths.dist}/${serverPath}`));
});

Expand Down Expand Up @@ -335,7 +343,7 @@ gulp.task('watch', () => {

plugins.watch(paths.client.scripts) //['inject:js']
.pipe(plugins.plumber())<% if(filters.babel || filters.coffee) { %>
.pipe(transpile())
.pipe(transpileClient())
.pipe(gulp.dest('.tmp'))<% } %>
.pipe(plugins.livereload());

Expand Down

0 comments on commit bb67961

Please sign in to comment.