Skip to content

Commit

Permalink
add ES2015 support
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed Oct 10, 2015
1 parent 3ae6771 commit 544d54f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"esnext": true,
"preset": "google",
"disallowSpacesInAnonymousFunctionExpression": null,
"excludeFiles": ["node_modules/**"]
Expand Down
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"esnext": true,
"node": true,
"browser": true,
"bitwise": true,
Expand Down
17 changes: 14 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ gulp.task('elements', function () {
return styleTask('elements', ['**/*.css']);
});

// Transpile all JS to ES5.
gulp.task('js', function () {
return gulp.src(['app/**/*.{js,html}'])
.pipe($.sourcemaps.init())
.pipe($.if('*.html', $.crisper())) // Extract JS from .html files
.pipe($.if('*.js', $.babel()))
.pipe($.sourcemaps.write('.'))
.pipe(gulp.dest('.tmp/'))
.pipe(gulp.dest('dist/'));
});

// Lint JavaScript
gulp.task('jshint', function () {
return gulp.src([
Expand Down Expand Up @@ -123,7 +134,7 @@ gulp.task('fonts', function () {

// Scan your HTML for assets & optimize them
gulp.task('html', function () {
var assets = $.useref.assets({searchPath: ['.tmp', 'app', 'dist']});
var assets = $.useref.assets({searchPath: ['.tmp', 'dist']});

return gulp.src(['app/**/*.html', '!app/{elements,test}/**/*.html'])
// Replace path for vulcanized assets
Expand Down Expand Up @@ -233,7 +244,7 @@ gulp.task('serve', ['styles', 'elements', 'images'], function () {
gulp.watch(['app/**/*.html'], reload);
gulp.watch(['app/styles/**/*.css'], ['styles', reload]);
gulp.watch(['app/elements/**/*.css'], ['elements', reload]);
gulp.watch(['app/{scripts,elements}/**/{*.js,*.html}'], ['jshint']);
gulp.watch(['app/{scripts,elements}/**/{*.js,*.html}'], ['jshint','js']);
gulp.watch(['app/images/**/*'], reload);
});

Expand Down Expand Up @@ -265,7 +276,7 @@ gulp.task('default', ['clean'], function (cb) {
// Uncomment 'cache-config' after 'rename-index' if you are going to use service workers.
runSequence(
['copy', 'styles'],
'elements',
['elements', 'js'],
['jshint', 'images', 'fonts', 'html'],
'vulcanize','rename-index', // 'cache-config',
cb);
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"glob": "^5.0.6",
"gulp": "^3.8.5",
"gulp-autoprefixer": "^2.1.0",
"gulp-babel": "^5.2.1",
"gulp-cache": "^0.2.8",
"gulp-changed": "^1.0.0",
"gulp-crisper": "0.0.5",
"gulp-cssmin": "^0.1.7",
"gulp-flatten": "0.0.4",
"gulp-if": "^1.2.1",
Expand All @@ -19,6 +21,7 @@
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.3",
"gulp-size": "^1.0.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.2.0",
"gulp-useref": "^1.1.2",
"gulp-vulcanize": "^6.0.0",
Expand All @@ -38,4 +41,4 @@
"engines": {
"node": ">=0.10.0"
}
}
}

0 comments on commit 544d54f

Please sign in to comment.