Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX gulpfile for ES5 files #43

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions config.yml
Expand Up @@ -27,9 +27,9 @@ PATHS:
sass:
- "bower_components/foundation-sites/scss"
- "bower_components/motion-ui/src"
# Paths to JavaScript libraries, which are combined into one file
javascript:
# Libraries required by Foundation
# Paths to JavaScript libraries, which are compined into one file
york-xtrem marked this conversation as resolved.
Show resolved Hide resolved
javascriptES6:
# Libraries requried by Foundation
york-xtrem marked this conversation as resolved.
Show resolved Hide resolved
- "bower_components/jquery/dist/jquery.js"
- "bower_components/what-input/dist/what-input.js"
# Core Foundation files
Expand Down Expand Up @@ -57,6 +57,9 @@ PATHS:
- "bower_components/foundation-sites/js/foundation.toggler.js"
- "bower_components/foundation-sites/js/foundation.tooltip.js"
- "bower_components/foundation-sites/js/foundation.zf.responsiveAccordionTabs.js"
# Paths to your own project code are here
# ES6 files
# - "bower_components/example/js/example.js"
# Paths to your own project code or ES5 files are here
javascriptES5:
- "src/assets/js/!(app).js"
- "src/assets/js/app.js"
9 changes: 7 additions & 2 deletions gulpfile.babel.js
Expand Up @@ -9,6 +9,7 @@ import rimraf from 'rimraf';
import sherpa from 'style-sherpa';
import yaml from 'js-yaml';
import fs from 'fs';
import filter from 'gulp-filter';

// Load all Gulp plugins into one variable
const $ = plugins();
Expand Down Expand Up @@ -95,9 +96,13 @@ function sass() {
// Combine JavaScript into one file
// In production, the file is minified
function javascript() {
return gulp.src(PATHS.javascript)
.pipe($.sourcemaps.init())
const jsES6 = filter(PATHS.javascriptES6, {restore: true});
const js = PATHS.javascriptES6.concat(PATHS.javascriptES5);
return gulp.src(js)
.pipe(jsES6)
.pipe($.babel({ignore: ['what-input.js']}))
.pipe(jsES6.restore)
.pipe($.sourcemaps.init())
.pipe($.concat('app.js'))
.pipe($.if(PRODUCTION, $.uglify()
.on('error', e => { console.log(e); })
Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -20,6 +20,7 @@
"gulp-concat": "^2.5.2",
"gulp-cssnano": "^2.1.0",
"gulp-extname": "^0.2.0",
"gulp-filter": "^4.0.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.2.1",
"gulp-load-plugins": "^1.1.0",
Expand All @@ -42,7 +43,9 @@
"email": "foundation@zurb.com"
},
"babel": {
"presets": ["es2015"]
"presets": [
"es2015"
]
},
"private": true
}