not creating files in non-development mode
hello, their is a comment in lib/less/more.rb that states:
By default, Less::More.parse will be called for each request in development environment and on application initialization in production environment.
However, this doesn't seem to be the case, and I didn't find any information that highlighted as such. Two suggestions for rails/init.rb
- don't hardcode development. Instead use ActionController::Base.perform_caching, which means we can change the behavior in our dev environment (like making sure everything comes together).
- make it an if/else statement, and if performing caching, call Less::More.generate_all, else load the action_controller_ext, which puts that on a before_filter hook.
what do you think?
the comment is outdated. You should put the generated css into version control, the idea is that you do not need to install less on all your production servers.
I would never have checked in my .css files or any generated file in a git repo. I'm pretty hardcore on this, though, I don't check in, say, jquery either, I add the jquery repo as a submodule and build it from source.
So, is the current version of the plugin not creating the CSS files when the app boots in prod mode?
Better question: does the plugin now require that you check the generated CSS into the repo?
Grosser: ok. I generally don't like to checkin automated files (so easy for them to become outdated!), and:
- installing a gem in production is not difficult; in fact I bet most people just install all the gems they need via config.gem or the soon to be standard Gemfile
- More requires the less gem, so are people not to install the plugin?
- for most people, the less steps and easier to get up and running, the better,
- and for those people that want to check-in precompiled versions, they can and More won't overload them.
BUT, for those of us that like to not check in compiled css, the answer is to include
Less::More.generate_all
in an initializer and call it good
i think a better solution (in case you do not want to checkin the css) is to rake more:generate when deploying, so the modified timestamps stay the same(users do not need to load duplicated css from servers with different mtime), and you do not add more time (in our case ~8 seconds) to the per-process reboot time
Very good point, grosser. Generating CSS belongs in "deployment", not "starting process".
So in order to close this issue, the README needs to be updated :)