-
Notifications
You must be signed in to change notification settings - Fork 3
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
Using with Rails 3.1 #2
Comments
Rails 3.1 uses Tilt for processing sass and coffeescript. Tilt is currently at 1.3.2 and will include less-js support in 1.4. For now I've forked it and added less-js. In your Gemfile:
and then Then in your assets/stylesheets name files as 'file.css.less', if you're using Let me know if you face any issues. I should probably blog about this somewhere. |
Oh, btw if you want to compress your css: Gemfile:
config/environments/production.rb:
This will compress the css. |
Thanks this worked great. On the CSS minification I know that the less.js command line tool can minify files, would it be possible to add support for minification through the less-js gem? I have no problem using yui but this would definitely be a nice feature. Thanks again for your help! |
It seems that bundler doesn't fallback from the git to http(s) protocol if there's a timeout (e.g., in-house web proxy), so I had to change
in case anyone has trouble installing/updating their bundle using the code above. |
I tried following these instructions for a rails 3.1 project and I ended up with this error: body:before { Any ideas? thx! |
@kbaum I have the same issue. It works with simple .css.less files but when I want to import another less file it tells me 'loadStyleSheet is not defined'. application.css contains the following line: *= bootstrap/bootstrap.less Server log: Started GET "/assets/application.css" for 127.0.0.1 at 2011-08-31 16:17:07 +0200 This is the output returned in my application.css:
I'm going to switch to the regular less.js method but this seems like a bug to me :) |
The asset pipeline pulls in the processed less file. So when you include bootstrap.less in your application.css file, it only pulls in the parts that compile to proper css. And then it loads your own css files, so your css files don't see the variables and mixins created by the bootstrap file (or files that the bootstrap file imports). I haven't had time to look into how we can get tilt/sprockets to honour the less imports. However, a (temporary?) solution to this would be to pull in the import files directly into your less file: <%= File.read "#{Rails.root}/vendor/assets/stylesheets/bootstrap.less" %> And you'd have to rename your less file to end with "css.less.erb" so that the ruby is executed. Not sure if there is a better way of doing this yet. |
Until we can get rails to handle less like sass, i think the best option is to go with the less osx app. I think you just let the app watch your less files and it generates the css which you check in to the repo. thx! |
@thisduck: worked like a charm!! For those wondering: /*!
/* CSS Reset */ /* Core */ /* Styled patterns and elements */ This gets picked up by the asset pipeline. Also, make sure the bootstrap folder doesn't get picked up by default by the asset pipeline and everything will 'load' in order. Thx for the tip. |
There's not much documentation out there about working with the asset pipeline in Rails 3.1
Do you have any guidance on how to use the Less.js as a css_compressor in RoR 3.1?
I've already included it in the gemfile and have run
bundle update less-js
The text was updated successfully, but these errors were encountered: