i am trying to use sass in a rails 3.0.1 project that i am working on. I install the gem but when i create a scss file and add some style nothing happens. I've been searching for an answer and it seems others have haml installed as well, do I need this?
I think you should add the assets pipeline (Sprockets) in addition to SASS.
Here is a gist that explains the setup for Rails 3.0.x.
https://gist.github.com/911003
Related
Im trying to put the bootstrap source files in my rails project but I am not seeing an "assets" folder in my app folder. Are the Image, Javascript, and CSS folders in "public" the same thing? If not then where do I put the source files? I am using ruby version 1.9.2-p290, rails version 3.0.19, and bootstrap version 2.3.2. Not sure if that makes a difference or not.
Why don't you just use a bootstrap gem like bootstrap-sass instead?
Look at this project: twitter-bootstrap-rails
It is an easy way to set up bootstrap in your Ruby on Rails project.
Is twitter-bootstrap-rails compatible with rails 4 and ruby 2.0. I was having tons of trouble installing this on my rails app after going through two railscast and the readme on its github page. Sorry I couldn't find a straight forward answer both in the repo's issues and from googling online.
on the repo page it says
Twitter Bootstrap for Rails 3.1 Asset Pipeline
To get bootstrap in Rail 4.
Add gem 'bootstrap-sass' to your Gemfile.
and then add #import "bootstrap-sprockets";
and #import "bootstrap";
to the top of your application.scss file. Don't forget to run bundle install.
I'm trying to create a gem which represents a JS and CSS library and can be included in rails projects (currently using 3.2). All the style sheets are written in SASS and depend on the compass library.
I tried adding compass-rails to the Gemfile of the "external" gem and including it in the gems SASS files using
#import "compass"
However, back in the rails application (which has a dependency to this gem), this results in an error message:
File to import not found or unreadable: compass.
Am I doing something wrong?
Update: It seems to work if I add gem compass-rails to the Gemfile of the rails application. Any change to work around that?
Thanks a lot for your help!
Besides adding compass-rails to the Gemfile of the gem, you also need to require 'compass-rails' somewhere, adding it to lib/your_gem_name.rb inside the gem worked for me.
I noticed today that haml & sass have split in their upgrade to 3.1.
I used to get them both in my Rails project with gem 'haml-rails' (though, perhaps I manually added SASS to my gem directory?!? Anyway...)
I'm trying to understand dependencies & whatnot and wondering what I need to do now to get both haml & sass updated to 3.1 in my project(s)...
I see haml docs now say to use gem 'haml' to get haml...does this mean haml-rails is unnecessary/redundant now?
Based on my test, you still need haml-rails if you want .haml views automatically generated when you run rails g controller or rails g scaffold
I think it is, yes. I've just started using SASS in my Rails 3 project, and my Gemfile just contains:
gem 'haml'
... and everything appears to be working fine, as far as I can see.
UPDATE: Just realised I was actually running 3.0.25 when I wrote this post, but gem 'haml' already worked at that stage. I've just upgraded to 3.1.1, and it's still working fine :)
I have Haml/Sass installed as a Gem and using it with Rails. I can't figure out, how to pass options like template_location and style to Sass. Sass::Plugin.options doesn't work (since Haml/Sass isn't installed as a plugin). The gem is required through Rails::Initializer#gem.
Sass::Plugin.options should still work -- the "Plugin" refers to Sass being used with Rails, as opposed to standalone.