Last active
April 19, 2016 19:30
-
-
Save lavaldi/c8926a84406302fa594cb4fbab88db9c to your computer and use it in GitHub Desktop.
Task of gulp to pass ES6 to ES5 with ESLint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"env": { | |
"es6": true, | |
"browser": true, | |
"node": true | |
}, | |
"globals": { | |
"jQuery": true, | |
"$": true | |
}, | |
"rules": { | |
"eqeqeq": "off", | |
"arrow-body-style": ["error", "always"], | |
"comma-spacing": ["error", { "before": false, "after": true }], | |
"indent": ["error", 2], | |
"prefer-const": "error", | |
"space-infix-ops": ["error"], | |
"space-before-function-paren": ["error", { "anonymous": "never", "named": "always" }] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('js:es6', function () { | |
return gulp.src(pathFiles.frontend.js + '/modules/**/*.js') | |
.pipe(plugins.recursiveConcat({ extname: '.js' })) // concatenate files | |
.pipe(plugins.eslint({config: pathFiles.frontend.config + '/.eslintrc.json'})) | |
.pipe(plugins.eslint.format()) | |
.pipe(plugins.eslint.failAfterError()) | |
.pipe(plugins.iife({ prependSemicolon: false })) // push "use strick" and encompasses the modules | |
.pipe(plugins.babel({ presets: ['es2015'] })) / ES6 to ES5 | |
.pipe(plugins.if(config.PROD, plugins.uglify({ | |
mangle : true, | |
compress: { | |
drop_console: true | |
} | |
}))) | |
.pipe(gulp.dest(pathFiles.dest.js + '/modules')) | |
.on('end', functions.successHandler); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment