Closed tomprats closed 7 years ago
Which alternative route are you talking about?
Sorry I'm not very familiar with how this gem works yet, but I was referring to using register_template_handler
versus the sprockets register methods.
To add some context, I was working on building an alternative to https://github.com/jsdf/sprockets-coffee-react and my work so far is in https://github.com/tomprats/sprockets-cjsx. I had to add a transformer for coffee because I couldn't find a way to hook into this gem in the way a preprocessor would for sprockets.
@tomprats hello, actually this gem doesn't handle converting assets from coffee to js, this is done in sprockets itself in CoffeeScriptProcessor using the coffee-script gem that's a wrapper for coffee-script JS library executed in Ruby thanks to ExecJS
The included template handler and the register_template_handler
method is for .coffee
views living under app/views
in Rails applications, not for Sprockets processors.
Oh wow, thanks @guilleiguaran. I'll look into that. I misinterpreted the first part of the description "CoffeeScript adapter for the Rails asset pipeline". Thanks for all your help guys!
I've been familiarizing myself with Sprockets and how the Transformers and Processors work, but when I was trying to write a Preprocessor for Coffee I noticed I couldn't. I believe this gem handles converting Coffee to JS, but I was wondering why it uses an alternate route.
Is there any way to add preprocessors to it?