Skip to content
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

responsive.less #26

Closed
nahue opened this issue Feb 3, 2012 · 15 comments
Closed

responsive.less #26

nahue opened this issue Feb 3, 2012 · 15 comments

Comments

@nahue
Copy link

nahue commented Feb 3, 2012

Bootstrap.less is not loading responsive.less !

@metaskills
Copy link
Owner

They do not do this upstream either.
https://github.com/twitter/bootstrap/blob/master/less/bootstrap.less

Perhaps you should do @import 'twitter/bootstrap/responsive.less instead after your import for twitter bootstrap?

@sandbox
Copy link

sandbox commented Feb 3, 2012

In their repository, the Makefile file builds a bootstrap-responsive.css.

It would be a nice to have, if you could similarly do a require 'twitter/bootstrap-responsive'

@metaskills
Copy link
Owner

Does require 'twitter/bootstrap/responsive' work?

@sandbox
Copy link

sandbox commented Feb 4, 2012

It doesn't work, I had to add a bootstrap-responsive.css.less file then in that file do @import "twitter/bootstrap/responsive"; and then you can do require bootstrap-responsive. It looks similar to what you did for bootstrap.css.less in assets/stylesheets.

@nahue
Copy link
Author

nahue commented Feb 4, 2012

Well that works :) but it should be working outside the box dont you think?

@metaskills
Copy link
Owner

Well, but @import "twitter/bootstrap/responsive"; should work, I have all the load paths setup to do so. So this ticket is for the case where you want to require it via a sprockets directive which to me is an anti-pattern when working with the less files. But I agree we should cover that case and I think it would be easy to create the css.less file to make this happen.

@shanepinnell
Copy link

I was just trying this out and @import "twitter/bootstrap/responsive"; works just fine for me. I created an empty imports.css.less file with that one line in it and voila...

ruby 1.9.3
rails 3.1.2
bootstrap 2.0
less-rails-bootstrap 2.0.2

Now to figure out how the responsive stuff actually works!

@shanepinnell
Copy link

The order of importing seems to be VERY important for this to work. While I am able to import the responsive.less file, I have yet to figure out how to get it loaded after bootstrap.css

@shanepinnell
Copy link

Removing = require_tree . and adding = require imports works for me. I have a custom .less file named imports.css.less with the @import "twitter/bootstrap/responsive"; directive in it. I don't like removing *= require_tree . because that seems to break the intended benefit of the asset pipeline. Is there any way to specify a loading order?

@metaskills
Copy link
Owner

I will say that how you import things and use the sprockets manifest is the key to using less. I tried to document some best practices in the initial read me. Also, require_tree is just downright evil and can lead to some really unintended consequences unless you know what you are doing. Even certain rails casts mention that. Ok as a default generator stand in and makes sense when and if you know how to use it best.

Lastly, I do think we can get responsive in a way that works for everyone. I am just waiting to hear more about why and how and as of now I still assert that having a sprockets manifest that that requires you main foo.css.less and everything in that imports all other less files like twitter/bootstrap and in this case twitter/bootstrap/responsive too if so desired. There is a reason they left it out of the bootstrap.less loader and I do not want to add anything without know the best practices. So still waiting to here more and hopefully get a good pull request.

@troex
Copy link

troex commented Feb 8, 2012

@lelio98 idea approach on how to enable responsive css should be added to README

@shanepinnell
Copy link

@troex after reading @metaskills latest comment it may be best to wait to see what he comes up with as a best practice.

@metaskills
Copy link
Owner

I'll do that this weekend when I write a related blog article too. Will update the docs to help.

@vstabile
Copy link

great, I'm looking forward to it

@metaskills
Copy link
Owner

I made a test project called less-rails-bootstrap-test with working examples of how to use these gems. Please see the "CSS Tests Suites" section of the README and review the code.

https://github.com/metaskills/less-rails-bootstrap-test

The full control method should allow you to import responsive where it fits in. That could be at the bottom of the index.css.less file below all the other bootstrap imports.

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

No branches or pull requests

6 participants