Wanted to try something new, using the awesome twitter bootstrap and their Less CSS. I finally got my app up and running, but it crashed at heroku’s read-only system.
I’m trying to figure out my options, using LESS, rails 3.2 and heroku. This is what I think can do:
(1) One option is: precompile.
bundle exec rake assets:precompile
git commit public/assets -m "tedious precompilation task"
git push heroku
I’ll surely forget to precompile once, just push the changes to heroku and piss off my users. Not what I want.
(2) A good option is less.js. It compiles client-side. Is this what most use?
(3) A better option, IMO. Precompile to cache. Neither a precompile routine nor extra client side work. What I’m asking, is there something like hassle for SASS, for less?
UPDATE 26th jan-12: people don’t use hassle rails 3.1+, they use sass-rails (default rails 3.2) with the asset pipeline. hassle is sooo rails 3.0 😉 The rake precompile step failed at heroku. /UPDATE
I find the idea of compiling to static rack cache to be served by varnish absolutely brilliant. I’d prefer it over having every client needing to compile my less css themselves when it can be done one time, at deploy.
UPDATE 25th jan: Updating myself on heroku. The cedar stack supports the asset pipeline, so there is no need for the hassle gem anymore. Correct? /UPDATE
What to do?
Solution:
Simple solution, once you know it …. !
Use with
gem less-railsNow all assets are compiled and will be cached, (as in option 3). The asset pipeline is awesome!
Problem background:
Heroku couldn’t precompile as rails pr default tries to initialize and attach to DB, but the ENV vars ain’t available yet. Without it you’d get
Just as a note: Heroku has a way of providing the environment variables at precompile stage too.