Permalink
Browse files

Babelize build/ js files only

  • Loading branch information...
1 parent 9c5527f commit 713ca22473306f55da3d436878f9cd825f8dd3ff @Riccardo-Zanutta committed Jun 24, 2016
Showing with 691 additions and 9 deletions.
  1. +2 −0 config.json
  2. +11 −6 gulpfile.babel.js
  3. +1 −0 package.json
  4. +667 −1 src/css/application.css
  5. +7 −1 src/js/application.js
  6. +3 −1 src/js/build/main.js
View
@@ -8,6 +8,8 @@
"autoprefixer_options": {
"browsers": ["last 3 versions", "ie > 9", "and_chr >= 2.3"]
},
+ "js_build_src": "./src/js/build/**/*.js",
+ "js_vendor_src": "./src/js/vendor/**/*.js",
"js_src": ["./src/js/vendor/**/*.js", "./src/js/build/**/*.js"],
"js_file_name": "application.js",
"js_dest": "./src/js"
View
@@ -14,6 +14,7 @@ import gulpLoadPlugins from 'gulp-load-plugins';
import browserSync from 'browser-sync';
import del from 'del';
import runSequence from 'run-sequence';
+import merge from 'merge2';
import { argv } from 'yargs';
const $ = gulpLoadPlugins();
@@ -37,16 +38,20 @@ gulp.task('styles', () => {
.pipe(gulp.dest(config.sass_dest))
});
-// Concat, sourcemaps and minify js files
+// Concat, babelify, sourcemaps and minify js files
gulp.task('scripts', () => {
- gulp.src(config.js_src)
+ return merge(
+ gulp.src(config.js_vendor_src)
+ .pipe($.size({title: 'Vendor scripts'})),
+ gulp.src(config.js_build_src)
+ .pipe($.babel())
+ )
.pipe($.if(argv.pretty, $.sourcemaps.init()))
- .pipe($.babel())
.pipe($.concat(config.js_file_name))
.pipe($.if(!argv.pretty, $.uglify({preserveComments: 'some'})))
- .pipe($.if(argv.pretty, $.sourcemaps.write('.')))
+ .pipe($.if(argv.pretty, $.sourcemaps.write('./')))
.pipe($.size({title: 'Scripts'}))
- .pipe(gulp.dest(config.js_dest))
+ .pipe(gulp.dest(config.js_dest));
});
// Clean the dist/ folder
@@ -56,7 +61,7 @@ gulp.task('clean', () => {
])
});
-// Copy the content from the src/ folder to the dist/ one
+// Copy the content from src/ to dist/
gulp.task('copy', ['clean'], () => {
return gulp.src(config.src_folder)
.pipe($.size({title: 'Copying ./src content in ./dist'}))
View
@@ -37,6 +37,7 @@
"gulp-task-listing": "^1.0.1",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
+ "merge2": "^1.0.2",
"run-sequence": "^1.1.5",
"yargs": "^4.3.2"
}
Oops, something went wrong.

0 comments on commit 713ca22

Please sign in to comment.