Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

not creating files in non-development mode #27

Open
skippy opened this issue Feb 19, 2010 · 6 comments
Open

not creating files in non-development mode #27

skippy opened this issue Feb 19, 2010 · 6 comments

Comments

@skippy
Copy link

skippy commented Feb 19, 2010

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?

@grosser
Copy link
Contributor

grosser commented Feb 19, 2010

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.

@augustl
Copy link
Contributor

augustl commented Feb 19, 2010

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?

@augustl
Copy link
Contributor

augustl commented Feb 19, 2010

Better question: does the plugin now require that you check the generated CSS into the repo?

@skippy
Copy link
Author

skippy commented Feb 19, 2010

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

@grosser
Copy link
Contributor

grosser commented Feb 19, 2010

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

@augustl
Copy link
Contributor

augustl commented Feb 20, 2010

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 :)

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

No branches or pull requests

3 participants