I would like to use compass_twitter_bootstrap. Here is what I did:
1)
My Gemfile:
gem 'compass'
gem 'compass-rails'
gem 'compass_twitter_bootstrap'
2)
My compass.rb under config folder:
require 'compass_twitter_bootstrap'
project_type = :rails
http_path = "/"
css_dir = "public/stylesheets"
sass_dir = "public/stylesheets/sass"
3)
I created a scss file under public/stylesheets/sass and I aded @import "compass_twitter_bootstrap"; on the top of the file.
4)
I also added the stylesheet_link_tag into my html.erb file.
But when I run the server, I get this error:
syntax error, file to import not found or unreadable: compass_twitter_bootstrap load path: my_project_directory/public/stylesheets/sass
Is this a Rails application or a Rails plugin?
If it's a Rails plugin, this Stackoverflow question explains that it has to do with what the Dummy app looks for in your Gemfile. Basically, don't use
group :assets
as you would in a Rails app. Don't usegroup __anything__
for that matter.Anything in a group won't be loaded because Bundler.require (line 5 of test/dummy/config/application.rb) doesn't take any arguments. Compare it to the corresponding line of code in a Rails app, which takes the Rails.env group (i.e. either :production or :development or :test) and sometimes :assets.
The other option, of course, is to pass an arg to
Bundler.require
for each group in the Gemfile that you want to include. If you do this, make sure to include :default.ADDED later in the day on 11/29:
For clarification, the real cause of the error is that the @import directive means something different in CSS than it does in Sass. My answer above really addresses the issue of why the file is being parsed as CSS when you want it to be parsed as Sass. For it to be parsed as Sass, the sass-rails gem needs to be included. Besides the answer above, there could be other reasons for this, so even if you're working with a Rails app and the issue is not whether Bundler is including gems in the :assets group, there may be some other reason why sass-rails isn't included when you expect it to be. Check your Gemfile to make sure sass-rails is there and if it's in a group, try moving it out to see if that changes things.