Es6 - Using Babel/traceur With Jquery Plugins
I want to be able to write ES6 with jQuery plugins and compile the code down to ES5 using Gulp Babel, without having to use Browserify to make them work. For example, I may have a
Solution 1:
Answering my own question here. I did some digging and it looks like the best way of dealing with this issue at the moment is using jspm with the es6-module-loader.
Gulpfile:
var gulp = require('gulp');
var del = require('del');
var shell = require('gulp-shell');
gulp.task('clean', function(cb) {
del('dist', cb);
});
gulp.task('default', ['clean'], shell.task([
'jspm bundle-sfx app/main -o dist/app.js',
'./node_modules/.bin/uglifyjs dist/app.js -o dist/app.min.js',
'./node_modules/.bin/html-dist index.html --remove-all --minify --insert app.min.js -o dist/index.html'
]));
HTML:
<head><title>ES6</title><scriptsrc="jspm_packages/system.js"></script><scriptsrc="config.js"></script><script>System.import('app/main');
</script></head>
The repo I created here will also show you how to do it
Post a Comment for "Es6 - Using Babel/traceur With Jquery Plugins"