documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Untitled #55

Closed foreverman closed 14 years ago

foreverman commented 14 years ago

Hey,

I just begin to use jammit as an assert packager. I want to package or not package assets based on rails environment, so I configured my assets.yml like this:

<% if Rails.env.production? %> package_assets: on <% else %> package_assets: off <% end %>

According to my understanding, we should generate the assets package by running the command line utility "jammit", otherwise the server just package the assets on the fly(please correct me if I am wrong). But I got "(erb):1: uninitialized constant Rails (NameError)" when I tried to run 'jammit' command under my rails app folder.

Any idea about this?

Thanks a lot!

jashkenas commented 14 years ago

Hi foreverman.

The default setting of Jammit is to package assets in all environments except for production -- there's no need to mess with ERB in the config.yml file to accomplish this.

Simply run the jammit command in your Rails project, and the assets will be generated.

foreverman commented 14 years ago

Hey jashkenas,

Thanks for the suggestion! I see your point. Another question is what is the difference between 'jammit' and 'jammit --force'? Should I use the 'jammit' with 'force' option or without it after redeploying my code?

Thanks.

jashkenas commented 14 years ago

It depends on how your deploy process changes the mtimes of the JavaScript source files. Unless it's doing something strange like setting the mtimes in the past, regular jammit should be just fine. If you ever run into a problem where you have a package whose contents have changed, but hasn't been regenerated, use jammit --force.