Skip to content
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

Support for ERB in JavaScript files #75

Closed
rbhitchcock opened this issue Jun 21, 2013 · 4 comments
Closed

Support for ERB in JavaScript files #75

rbhitchcock opened this issue Jun 21, 2013 · 4 comments

Comments

@rbhitchcock
Copy link
Contributor

If I understand things correctly, Sprockets will process Ruby in JavaScript files if .erb is appended to the end. It seems to me that this can be enabled by simply changing some of the file name checks to allow for .erb to be present at the end, and then Sprockets will handle the rest. Does this seem accurate? Or does handlebars_assets run before that sort of processing would occur? I'd be happy to attempt to implement it if you think it would be useful.

@AlexRiedler
Copy link
Collaborator

it should for the most part work out of the box "foo.hbs.erb" for instance; did this not work for you?

@rbhitchcock
Copy link
Contributor Author

Actually I hadn't tried yet because it doesn't mention it in the README. I apologize if this issue is noise. But looking at the code for a PR I submitted I noticed that it determines, for instance, a haml file if it ends with a .haml extension. So it seems if I did something like file.haml.erb it would not compile properly.

@leshill
Copy link
Owner

leshill commented Jun 21, 2013

Hi @rbhitchcock,

@AlexRiedler is correct, please try it.

For .hamlbars, we do not register the .hamlbars extension with sprockets, it is used to mark ‘compile haml too!’ whenever needed as part of the handlebars compile. .erb is registered by a sprockets engine that will handle that extension and then pass on to the next extension handler.

@rbhitchcock
Copy link
Contributor Author

Excellent... thank you for the feedback! Again, I apologize for the noise. I just made an assumption but should have done my own testing before filing an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants