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
assets:precompile fails if using js.erb and <%= %> #6892
Comments
|
Confirmed, and I made a simple test app: https://github.com/steveklabnik/rails_bug_6892 |
|
Heyo, just wanted to chime in. This isn't an issue with js.erb. Asset precompiling requires your JavaScript to not have syntax errors which is totally. In this case, you are most likely running rake assets:precompile without setting that FEE_CALC environment variable causing a syntax error in the example you provided. Try running FEE_CALC=2 rake assets:precompile and see what you get. |
|
Ahh, nice catch! Yep, it 100% works if the env is correct. @dongennl if you can demonstrate that this fails somehow with the variable set, please re-open, but I'm closing. |
|
hi guys, thanks for chiming in, but I'm not sure I understand completely. Isn't the point of an .erb extension that the file gets processed and the <% .. %> bits get replaced before being handed to any compressors? |
Yes. So what's happening here is that $('#invited_user').val(roundNumber(this.value * , 2));This is obviously wrong, and hence, 'unexpected puntuation ,'.
The task does load the environment, so yeah, initializers should run. I'm going to re-open this for the moment, but I'm sure there's something simple going on here. |
|
Okay, so, I added the definition to an initializer, and it Worked For Me: How are you defining the env var? |
|
Very strange! I have in config/initializers/constants.rb should work right? |
|
Yeah, I can't imagine that it wouldn't. Hm. Differences between your line and mine: quotes in key (shouldn't matter), float instead of decimal (shouldn't matter). Since I can't reproduce this in a basic app, I'm gonna give it a close. If you can give me a sample app that demonstrates the issue, we'll open it back up, and I'll pay attention to this thread and try to give you a hand, but I don't think there's much more I can do. Something else is screwy with your environment. |
Hi
after upgrading to 3.2.6 my assets:precompile fail if I use erb with a js file:
It works fine as soon as I replace the <%= ... %> with a constant. Have also tried with single quotes. It works fine in development environment.
The error is:
The text was updated successfully, but these errors were encountered: