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

rake assets:precompile not processing .hamlc #11

Closed
ar7hur opened this issue Dec 5, 2011 · 9 comments
Closed

rake assets:precompile not processing .hamlc #11

ar7hur opened this issue Dec 5, 2011 · 9 comments

Comments

@ar7hur
Copy link

ar7hur commented Dec 5, 2011

When I run "bundle exec rake RAILS_ENV=production assets:precompile", hamlc templates are not compiled. They are just put as is in the /assets directory.

On-the-fly compilation (like in development mode) works perfectly though.

Did I miss something ?

@netzpirat
Copy link
Collaborator

Can you try setting

config.assets.initialize_on_precompile = true

in your config/environments/production.rb?

@ar7hur
Copy link
Author

ar7hur commented Dec 5, 2011

You are the best !

I thought I did it, but I did not. It works perfectly. Congrats for the great job, this gem is changing my life :)

@ar7hur ar7hur closed this as completed Dec 5, 2011
@netzpirat
Copy link
Collaborator

Glad to hear you like it! The hint came from @thibaudgg and I thought it only applies to Heroku. I'll update the README.

@thibaudgg
Copy link

It always happens when you compile your assets in production mode.

@axs89
Copy link
Collaborator

axs89 commented Dec 12, 2011

This is an awesome gem, thanks. I did have one question specifically about this before I dig into it too much. I was wondering why it needed the full environment to precompile the assets (specifically the initialize_on_precompile flag in production). To make a long story short with my project on Heroku this is making me have to precompile assets before deploy, which I'd rather not do. If it's not too bad I'd be willing to dig in and try to relax this dependency, but I thought I'd ask about it first, because there might be a very legitimate reason that the dependency on the environment exists (or maybe it's just too difficult to pull it out). Thanks!

@netzpirat
Copy link
Collaborator

I haven't played with the initialize_on_precompile flag yet and the docs aren't very clear on this. What does partially in "you can partially load your application" mean? I don't know which parts are loaded or not.

@axs89
Copy link
Collaborator

axs89 commented Dec 12, 2011

Yeah, it's definitely a little confusing, and the docs don't help much. The main side effect of that flag (for me) is that it loads the entire rails environment, and initializers and other code that looks for a database connection will be allowed to run. That presents a bit of an issue when you're deploying to Heroku and want to compile resources at slug compilation (they have a writeup on the issue).

In any case other types of assets don't require the full environment and I suspect that we could probably get these hamlc templates compiled without it, so I'll dig around a bit and see if I can come up with something.

@netzpirat
Copy link
Collaborator

The only dependencies are the execjs gem for compiling and rails for registering the engine. I remember I saw another asset pipeline gem that had a dependency to the railtie gem and not rails. Perhaps worth giving it a try.

@axs89
Copy link
Collaborator

axs89 commented Dec 12, 2011

I think I got it (just sent a pull request). Turns out it was a relatively straightforward option to the Railtie initialization.

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

4 participants