getgrav / grav-plugin-assets

Grav Assets Plugin
https://getgrav.org
MIT License
17 stars 4 forks source link

Add babel support to js_pipeline ( Asset Manager ) #4

Closed robertovg closed 7 years ago

robertovg commented 7 years ago

Right now with Asset Manager we have the ability to minify and compress our javascript, which is very convenient, but would be nice to have a "build in" babel pipeline stage, to have the possibility of writing our javascript with ES6 and be compiled back with babel out of the box.

There is a way to configure something like that with Asset Manager?

Thanks in advance

PD: I thought this is better place to have it than on https://github.com/getgrav/ repository.

w00fz commented 7 years ago

This is really not very feasible with PHP and the PHP libraries used by Grav to minify. What you are asking for is transpiling more than compressing and minifying. It can only be done efficiently via webpack and the likes.

What you should do is to create a webpack config and put it at the root of your user folder then configure it to your needs. You can then either leave uglifyjs out of the equation and let Grav Asset Manager take care of minifying and compressing or you can just do it all in one go via webpack.

Personally I would let Grav compress and minify, this will ensure you have a faster development environment and smarter production cached assets.