andreyfedoseev / django-static-precompiler

Django Static Precompiler provides template tags and filters to compile CoffeeScript, LiveScript, SASS / SCSS, LESS, Stylus, Babel and Handlebars. It works with both inline code and external files.
Other
222 stars 60 forks source link

Question - Example of Babel? #99

Closed ahurlburt closed 6 years ago

ahurlburt commented 7 years ago

Thanks for the tool. It works great for compiling my less files. Could you please provide an example of babel in the docs? I can't get this working.

I get the error: StaticCompilationError at /test/ Error: Couldn't find preset "env" relative to directory "/var/www/testSite/static/js/test"

In settings.py

STATIC_PRECOMPILER_COMPILERS = ( ('static_precompiler.compilers.Babel', { "executable": "/usr/local/bin/babel", "presets": "env", }), 'static_precompiler.compilers.LESS' )

I installed babel via npm: npm install -g --save-dev babel-cli babel-preset-env

I have the package for env but it seems like it doesn't know where to look?

andreyfedoseev commented 7 years ago

@ahurlburt

What happens if you run babel directly, without using static_precompiler, like so:

/usr/local/bin/babel --presets env /var/www/testSite/static/js/test/test.es6

It looks like a bug in babel, see https://github.com/babel/babel/issues/4186