-
Notifications
You must be signed in to change notification settings - Fork 706
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
Add Babel task/recipe #348
Comments
Absolutely 👍 We'd like to include it in the core. |
You can open the PR with what you have and we can help you to finish it. |
would like to see that happen too. |
Yes ! 👍 + 1 |
Feels like I won't have time to open a PR but here's the task I'm currently using: // Compile JavaScript with ES2015+
gulp.task('scripts', () => {
return gulp.src(['app/scripts/**/*.js', '!app/scripts/vendor/**/*.js'])
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.concat('main.js'))
.pipe(gulp.dest('.tmp/scripts'))
.pipe($.sourcemaps.write('.'))
.pipe(browserSync.stream({ match: '**/*.js' }));
}); Not quite sure how it'll play together with the |
Yeah, some adjustments will have to be made… Thanks for sharing your workflow. |
I guess you can just add it to the return gulp.src('app/*.html')
.pipe(assets)
.pipe($.if('*.js', $.babel(), $.uglify()))
.pipe($.if('*.css', $.minifyCss({compatibility: '*'})))
.pipe(assets.restore())
.pipe($.useref())
.pipe($.if('*.html', $.minifyHtml({conditionals: true, loose: true})))
.pipe(gulp.dest('dist')); Not sure how this will work with |
After moving from grunt to gulp we use config like this: gulp.task('babel', () => {
return gulp.src(['app/scripts/**/*.js'])
.pipe($.sourcemaps.init())
.pipe($.babel())
.pipe($.sourcemaps.write())
.pipe(gulp.dest('.tmp/scripts'))
.pipe(reload({stream: true}));
}); |
@neilhem How you watch and recompile ?
And add
to serve, but it will not recompile the js . How can I do ? |
Changed to
works, why ? |
I added the watch tasks, but is the 'scripts' task that @wenerme added also working for the build? I can't tell if the build is building from the source files or the tmp folder. |
It's a pity the pull request received no updates any more, would love to have an easy way to write es6 js 😞 |
Yeah, it needs to be rebased and updated. I'll soon get around to fixing some long overdue issues, Babel will be one of them. |
Sounds awesome! Looking forward! 😍 |
Is it planned to support es6 modules with npm packages? |
For that we would need to add a module bundler. Since there are so many (browserify, webpack, jspm…), we're hesitant about that. E.g. webpack could replace gulp altogether, so that would be a major rewrite and should perhaps be a separate project. Do you have some preferences? |
Probably leave out the module functionality and integrate that into another project to keep that one simple. (e.g. only add basic transpiling to this generator) |
@alexej-d yes, my thoughts exactly. |
I have only used browserify so far. A separate project would be fine, but supporting modules using browserfiy wouldn't be that complicated either. |
Released in v1.1.0. |
@Keyamoon by the way, I'm maintaining generator-wbp, which uses browserify and stuff, it might be what you're looking for? |
@silvenon Thanks. Will take a look. With all the build tool options available, I'm no longer sure what I'm looking for! |
@Keyamoon I feel you. I spent a lot of time using and studying these tools, here's the summary of my experience:
If you have questions, feel free to send me an email or something, I'd be happy to help further. |
@silvenon That's a good summary. Thanks for sharing. |
Hi, would you be open to do an optional babel task (or recipe)? I've got it more or less working but there are some issues with uglify and how to properly fit the useref/serve/dist tasks properly.
The text was updated successfully, but these errors were encountered: