Anyone gotten this working with rails?
I'm using https://github.com/seyhunak/twitter-bootstrap-rails and would like to use less so I can use the variables etc.
I've tried importing variables.less and bootswatch.less sort of like this
# bootstrap_and_overrides.css.less
@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";
@import "bootswatch/variables";
@import "bootswatch/bootswatch";
But I get variable @textColor is undefined when running rake assets:precompile. Any ideas? Thanks!
I'm working on a solution here: http://github.com/maxim/bootswatch-rails, but it's mostly for bootstrap-sass. Haven't tested with twitter-bootstrap-rails. I prefer bootstrap-sass, because you get everything fully in sass format, which avoids problems with rails asset pipeline. No more having half the variables/mixins work in some stylesheets, while half in others, everything is pure scss.
I'm using it with twitter-bootstrap-rails. The solution I used to workaround the rake assets:precompile issue is the following :
In bootstrap_and_overrides.css.less :
@import "bootswatch";
body { padding-top: 60px; }
@import "twitter/bootstrap/responsive";
@import "variables";
And I added the following at the top of bootswatch.less :
@import "twitter/bootstrap/bootstrap";
Here's another workaround that I made just in case anyone is still wondering:
# config/environments/production.rb
config.assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css', '']) },
/(?:\/|\\|\A)application\.(css|js)$/ ]
Just telling assets pipeline to ignore files that resulted filename ends with no extension, in our case, variables.less etc.
@isc, i can't get it working, i've to change the bootstrap_and_overrides.css.less like follow:
@import "bootswatch";
body { padding-top: 40px; }
@import "twitter/bootstrap/responsive";
Then, in the bootswatch css file
@import "twitter/bootstrap/bootstrap"; @import "variables";
Otherwise, i've got an annoyng error during compilation.
variable @headingsFontFamily is undefined
@barmstrong I'm not sure if you resolved your problem or if a fix has been issued but I ran into the same problem today. The way I resolved the issue was in application.css: I took out the line that said "*= require tree ."; I think the problem was where the compilation tried to include bootswatch.less before even going through bootstrap_and_overrides.less (the less file from twitter-bootstrap-rails) or variables.less (due to the alphabetical nature of processing files?). Removing this line and adding "@import 'variables';" "@import 'bootswatch';" under the section describing custom LESS stylesheets in bootstrap_and_overrides.less resolves the problem.
TLDR remove the following line from application.css:
*= require tree .
I switched to using https://github.com/maxim/bootswatch-rails
It's awesome! And 100% sass. Huge props to @maxim
Gonna close for now (since my issue it solved) but feel free to keep discussing less solutions if it will help.