GithubHelp home page GithubHelp logo

compass-rails's Introduction

END OF LIFE - compass-rails

Don't use compass, it is no longer supported, see the compass statement

Build Status Code Climate Gem Version Coverage Status

Compass rails is an adapter for the Compass Stylesheet Authoring Framework for Ruby on Rails.

Since Compass v0.12.0, this is the only way to use compass with your rails application.

Supports Rails 5.2 and 6.x releases.

Installation

Add the compass-rails gem line to your application's Gemfile

gem 'sass-rails'
gem 'compass-rails'

If you are using any Compass extensions, add them to this group in your Gemfile.

And then execute:

$ bundle

Usage

Change your application.css to application.css.scss or application.css.sass and then @import compass and your own stylesheets to your hearts content. E.g.:

@import "compass";

@import "your_project/mixins";
@import "your_project/base";

or

Use application.css to require files that use compass features. Ex:

/*
 *= require styleguide_full_of_compass_stuff
 */

Don't use *= require something within your SCSS or SASS files. You're gonna have a bad time.

Configuration

Compass-rails is configured out of the box to work with Rails.

Advanced users can choose to add a config/compass.rb and take advantage of the Compass configuration reference as is.

Installing Compass extensions

Step 1: Add it to your Gemfile and run the bundle command to install it.

Step 2: Install the extension's assets: bundle exec compass install <extension/template>

For example, if you want to use susy.

# Gemfile
gem 'compass-rails'
gem 'susy'

then run:

$ bundle
$ bundle exec compass install susy

if you are using the rails configuration files you should add:

config.compass.require "susy"

to your application.rb configuration file.

Contributing

  1. This project is EOL. No more changes will be accepted.

compass-rails's People

Contributors

acandidmind avatar chriseppstein avatar craigmcnamara avatar danielpclark avatar hazg avatar jbarreneche avatar josepjaume avatar josh avatar marocchino avatar michaelabon avatar molily avatar mvastola avatar nadavshatz avatar olivierlacan avatar parndt avatar renchaorevee avatar rmm5t avatar s12chung avatar salimane avatar scottdavis avatar seuros avatar skorfmann avatar slbug avatar tamird avatar timhaines avatar tono avatar twalpole avatar vojtad avatar yhirano55 avatar yuki24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compass-rails's Issues

Instructions should mention that you need "sass-rails"

With:

group :assets do
  gem 'compass-rails'
end

I get:

> bundle exec compass init
NoMethodError on line ["15"] of /Users/tyson/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-rails-1.0.0.rc.1/lib/compass-rails.rb: undefined method `application' for Rails:Module
Run with --trace to see the full backtrace

But with:

group :assets do
  gem 'sass-rails',    :git => 'git://github.com/rails/sass-rails.git'
  gem 'compass-rails'
end

it works

This is on the latest rails HEAD.

Can't use the watcher

Hi,

> uname -a
Darwin maurizios-iMac.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64
> rbenv
rbenv 0.3.0
> ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
> rails -v
Rails 3.2.2
> rails new compass_test && cd compass_test
compass_test > cat Gemfile
# ...
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'compass-rails'
end
# ...
compass_test > cat app/assets/stylesheets/layout.scss 
a {
  color: red;
}
compass_test > compass watch .
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.

what am I missing?

Sprites file doesn't get generated

I had a sprites file generated by compass-rails in assets/images. Now I wanted to regenerate that sprite as the images the sprite file is based on changed. So i deleted the file. Now compass-rails doesn't regenerate it and I get a missing image error.

This is how I create the sprites in my application.css.scss file:

@import "layout/*.png";
@include all-layout-sprites;

compass-rails and Rails 2.3 not automatically compiling scss files

Hey guys,

I've been updating an old site and have walked through the instructions. When I hit views, the compilation isn't automatically kicking in. I can manually compile the stylesheets (e.g. bin/compass compile -e production) and they generate without warnings/errors.

Here's my compass.rb file:

project_type = :rails
css_dir = 'public/stylesheets/compiled'

Is there anything else I can provide that'd help? Any pointers in the right direction would be appreciated. Thanks!

Andrew

Undefined variable

index.sass
  @import 'compass'
  @import 'colors'
  @import 'some_other_partial'

colors.sass
  $main-color: #fff

some_other_partial.sass
  body
    color: $main-color

everything works perfect in development, but fails on assets:precompile with following error:

Undefined variable: "$main-color".
  (in /foo/my-app/app/assets/stylesheets/some_other_partial.sass)

Related versions:

compass (0.12.rc.1)
compass-rails (1.0.0.rc.3)
rails (3.2.1)

Tested on 1.9.3-p125 and 1.9.3-p0

Changing sprite generation directory

I'm not sure if this is a bug or human error... I'm trying to change the output directory used by sprite generation (following http://compass-style.org/help/tutorials/spriting/). I'd like to have these in their own directory which can be ignored by git, but they're currently generated at app/assets/images/.

I'm trying to change this by setting:

config.compass.generated_images_dir in an initializer:


require 'compass'

MyApp::Application.configure do
  config.compass.generated_images_dir = "/public/assets/"
  config.compass.generated_images_path = "/public/assets/"
end

But none of the directives seem to have any affect.

Thanks!

Unable to find compiled sprite in asset_host environment

Hi,

I'm having issues in our staging environment that uses an asset_host (and asset_sync), the server fails to run on first load with the following error. Rake assets:precompile works, and creates the file correctly.

Error :

File to import not found or unreadable: skin/icons/*.png. Load paths: Sass::Rails::Importer(/data/releases/20120423050001/app/assets/stylesheets/search.css.sass) /data/shared/bundled_gems/ruby/1.9.1/gems/compass-0.12.1/frameworks/compass/stylesheets /data/shared/bundled_gems/ruby/1.9.1/gems/compass-0.12.1/frameworks/blueprint/stylesheets (in /data/releases/20120423050001/app/assets/stylesheets/search.css.sass)

config/compass.rb :

project_type = :rails

http_path = "/"

config/environments/staging.rb

#Cut
  config.action_controller.asset_host = 'https://redacted.cloudfront.net'
  config.action_mailer.asset_host     = 'https://redacted.cloudfront.net'
#Cut

search.css.sass (failing line)

@import         "skin/icons/*.png"

This works locally, but fails in staging when linked to an asset_host, even though the file is definitely there (and the compiled version in the S3 bucket).

Am i missing something? Shouldn't the sass file never be re-generated (ie : never try and recompile the sprite after assets compilation)?

Are there any ways i can debug further, hacking into sass seems to be indicate all the relative paths are ok (when printing out prior to missing file error being displayed).

Full error stacktrace:

https://gist.github.com/2469496

Thanks,
Tom

Using compass-rails within a Rails::Engine

Hi there,
I'm developing a full Rails::Engine, and I would like to make use of compass-rails to help me building the stylesheets. Unfortunately I'm unable to import it:

my_rails_engine.gemspec:

  [...]
  s.add_dependency "compass-rails"
  [...]

my_rails_engine/app/assets/stylesheets/my_rails_engine/admin.css.sass:

+global-reset

The error:


rails (3.2.2), compass-rails (1.0.0.rc.3)

"File to import not found or unreadable: compass" on Heroku

I am trying to use compass in a Rails 3.2.2 application hosted on Heroku. After the deploy, I get
ActionView::Template::Error (File to import not found or unreadable: compass.)

I am including Compass via
@import "compass";

rake assets:precompile and bundle exec compass compile -e production --force ran without errors.

Compass v0.13.alpha.0 support?

I'm trying to mess around with Susy 1.0.rc.0 and it requires at least compass v0.13.alpha.0 support.

That or a manual way to install the compass alpha into my rails app. Any help?

Compass, Rails 3, and the @import directive

It is recommended (with good reason) to use the @import directive rather than Sprockets in Rails. This ensures that you can easily control the order of execution, that variables are persisted across SASS files, and that you don't have to @import parts of the Compass library at the top of every SASS file (like you do if using Sprockets to load SASS).

However there is a big downside to this – speed. This is most noticeable if you use LiveReload. Every time a SASS file is changed, everything is recompiled, which can take a few seconds in a large application. With Sprockets, only the changed file is compiled, which is in most cases almost instant.

What I am wondering is if there is a solution to this speed issue – is there something in my configuration that is not correctly set up, or is this the expected behaviour?

Tries To Process Non-Sass Files

Perhaps I'm going about this wrong, but while using Compass I can't seem to package a non-Sass css file in with our assets.

Here's my gem setup:

group :assets do
  gem 'sass-rails',     '~> 3.1.5'
  gem 'compass',        '~> 0.12.rc'
  gem 'compass-rails'
  gem 'uglifier',       '>= 1.0.3'
end

I have normal sass files that we've authored in app/assets/stylesheets and they are working as intended. However, I wanted to include the Twitter bootstrap CSS file. So, I attempt to put this file in vendor/assets/stylesheets. When I precompile my assets, I want the twitter bootstrap file to be given a digest timestamp so it will properly work with our production caching setup. I added this to applicaiton.rb:

config.assets.precompile += ['bootstrap.min.css']

The file in vendor/assets/stylesheets does not have a .sass or .scss extension, just simply .css, but Compass tries to compile it and it chokes:

Expected a color. Got: transparent
  (in MY_RAILS_ROOT/vendor/assets/stylesheets/bootstrap.min.css)
(sass):575

Can someone offer some advice? Is there a way to have Compass/Sass just skip over this file and not try to run it through the Sass compiler? Am I just doing something wrong?

Can Compass generate sprites from images in folders outside of app/assets/images"? Like in lib/assets/images or even Gems?

I was under the impression that Compass could generate sprites from image files in a Rails 3.1+ asset pipeline environment; however, I can't get it to work.

In my application.scss file I have the following code:

@import "foo/*.png";
@include all-foo-sprites;

If I have the foo directory in app/assets/images, this works just fine, but if I have it in lib/assets/images or vender/assets/images it doesn't work at all.

I keep getting the error:

No files were found in the load path matching "foo/*.png". Your current load paths are: /Users/xxxxxx/app/assets/images

But I know that vender/assets/images/foo is in the load path because image-url('foo/bar.png') works just fine.

What I'd really like is to have the images in a Gem (since they're shared across many of my apps), but I can't get that to work either.

Does anyone know if this is possible? I know compass-rails supports the asset pipeline, but I can't find anywhere that mentions support for this specific feature.

compass-rails overrides sass config variables

compass-rails seems to override any config.sass variables in environment files, e.g.development.rb.

e.g.

MyApp::Application.configure do
  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets  
  config.assets.debug = false

  config.sass.line_comments = false
  config.sass.style = :compact
end

In the output, the config.sass variables are ignored.

Sprite generation assuming asset pipeline even if not in use

I'm in the midst of trying to upgrade Compass from 0.11.7 to 0.12.2, and am running into a lot of pain.

The problem line in question that's causing problems is here. It looks like that line is assuming the use of the asset pipeline, which we don't, and so asset_url does not exist for us.

The full stack trace is here, and our compass.config file is here. The compass config is unchanged from the one we were using before, with the exception of the sprite_load_path line.

undefined method `separator' for "all":Sass::Script::String

Sorry if it was asked before but I'm getting this error almost always.

undefined method `separator' for "all":Sass::Script::String
  (in /home/eloyesp/projects/diputados/app/assets/stylesheets/active_admin.css.scss)

I have only this code in my app (in styleshets) and I'm beginer.

@import "compass/css3/transition";

.index.admin_expedientes tr {
  td.html_descrip p {
    @include transition("all 2s");
  }
}

I've tryed a lot of different ways, but I always get this error. What I'm doing wrong?

After upgrading to compass-rails 1.0.3 getting error

Sass:SyntaxError: Illegal Nesting, Only properties may be nested beneath properties
(in _replacement.scss:19)

It comes from including:

@import "compass/utilities";

in application.scss

Removing the import does not show the error.

Unable to have more than 1 sprite_load_path

(This issue is somewhat related to #5)

We're having problems adding sprite_load_paths to Compass's configuration. It seems like only the first path is actually used.

What we're trying to achieve is something like Rails's view paths inheritance - try to find a sprite image in one directory, if it doesn't exist, try the next directory from the sprite load paths.

We're using Rails 3.1.3, compass-rails 1.0.0.rc.3 and compass 0.12.rc.1.

Here's a sample Rails application that reproduced the problem: https://github.com/exviva/compass_rails_sprite_load_path

The application has two directories with sprite images: app/assets/images and app/assets/more-important-images. Both contain a directory called icons.

Both icons directories contain two files - one unique to them and one with the shared name.

The sprites are imported and used in app/assets/stylesheets/layout.css.scss.

The important bit is in config/initializers/compass.rb: it's adding both directories to sprite_load_path (using a technique suggested in #5).

I've also tried several other methods, and they all fail in the same way: only the directory added as first is available to the sprite importer.

When I try to request /assets/application.css, I'm getting the following error: No sprite called all_the_things found in sprite map icons/icons. Did you mean one of: y_u_no, yo_dawg. If I reverse the order of appending to sprite load paths, I get a similar error saying that yo_dawg cannot be found.

Is there something we're doing wrong? Is there even a way to make it work? I'd gladly provide a patch if possible.

Error compiling CSS asset

Sass::SyntaxError: Undefined mixin 'linear-gradient'.

I'm using rails 3.2.2 and:

group :assets do
gem 'sprockets'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'compass-rails'
end

thx

Sprite generation yields root path

I switched over to compass-rails, and everything worked very smoothly with the exception of my spriting.

When I try to @include mobile-sprite(tooltip); it will end up inserting background: url('/mobile-s04c77704f6.png') no-repeat and as a result Sprockets/Rails can't find the asset.

Is there a config option to modify the default generated route?

Would it make more sense to have it default to /assets/mobile-s04c77704f6.png?

It seems that there is mistake in project readme

Configure your project to look in app/assets/stylesheets by setting config.compass.sass_dir = "app/stylesheets" in your rails configuration

May be the right setting is config.compass.sass_dir = "app/assets/stylesheets"?

sprite helper doesn't seem to respect a base uri.

We're using a rails app under a base uri (using Rails/RackBaseURI with passenger). Images using the image-url helper generate the proper paths/urls when compiled, but sprite helpers seem to always use /assets (thereby throwing a 404). I tried setting a few config options in application.rb to see if that would work

config.compass.images_dir = "/app/assets/images"
config.compass.generated_images_dir = "/app/assets/images"
config.compass.http_generated_images_path = "/our-sub-uri/assets"

but urls generated by sprites still use /assets. The first 2 configuration options we ended up having to specify with the 3rd, or else compass would error saying it could not find our sprite paths. We are using sprite-map and sprite as so.

$fields:sprite-map("forms/*.png", $position: 0%, $spacing: 15px, $repeat: no-repeat);

#selector{ background:sprite($fields, arrow); }

Everything works perfectly until deployed under the sub-uri. Is there a configuation setting I'm missing somewhere?

sprockets/static_compiler fail

Gemfile:

gem 'compass-rails'


gem list -l

actionmailer (3.1.
actionpack (3.1.0)
activemodel (3.1.0
activerecord (3.1.
activeresource (3.
activesupport (3.1
addressable (2.2.6
arel (2.2.3, 2.2.1
bcrypt-ruby (3.0.1
builder (3.0.0)
bundle (0.0.1)
bundler (1.0.21)
chronic (0.6.6)
chunky_png (1.2.5)
cocaine (0.2.0)
coffee-rails (3.1.
coffee-script (2.2
coffee-script-sour
compass (0.12.1)
compass-rails (1.0
erubis (2.7.0)
execjs (1.3.0)
faraday (0.6.1)
fssm (0.2.8.1)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.
json (1.6.6, 1.6.1
linecache (0.46)
mail (2.3.3, 2.3.0
mime-types (1.18,
multi_json (1.2.0,
multipart-post (1.
mysql2 (0.3.11 x86
oauth (0.4.5)
oauth2 (0.4.1)
paperclip (2.3.12)
polyglot (0.3.3)
rack (1.3.6, 1.3.5
rack-cache (1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0)
railties (3.1.0)
rake (0.9.2.2)
rbx-require-relati
rdoc (3.12, 3.11)
ruby-debug-base (0
ruby-debug-ide (0.
sass (3.1.15)
sass-rails (3.1.6)
sorcery (0.7.4)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.32, 0.
uglifier (1.2.4)
whenever (0.7.2)

Uncaught exception: no such file to load -- sprockets/static_compiler
Exiting
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:innew_constants_in'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/compass-rails-1.0.0/lib/compass-rails/patches/static_compiler.rb:1
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:innew_constants_in'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/compass-rails-1.0.0/lib/compass-rails/patches/3_1.rb:1
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:innew_constants_in'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/compass-rails-1.0.0/lib/compass-rails/railties/3_1.rb:91
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:in instance_exec' C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:25:inrun'
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:50:in run_initializers' C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:ineach'
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in run_initializers' C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/application.rb:92:ininitialize!'
C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in send' C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:inmethod_missing'
D:/Projects/ExpedicionesFortuna/ExpedicionesFortuna/config/environment.rb:5
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in require' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:innew_constants_in'
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in load_dependency' C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:inrequire'
D:/Projects/ExpedicionesFortuna/ExpedicionesFortuna/config.ru:4
C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.3.5/lib/rack/builder.rb:51:in instance_eval' C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.3.5/lib/rack/builder.rb:51:ininitialize'
D:/Projects/ExpedicionesFortuna/ExpedicionesFortuna/config.ru:1:in `new'
D:/Projects/ExpedicionesFortuna/ExpedicionesFortuna/config.ru:1

Process finished with exit code -1073741510

"File not found or cannot be read" error for image file

Hey guys, I'm having this error:

File not found or cannot be read: /app/assets/images/create-a-simple-text-reminder-always-free.png

When trying to use this code:

+replace-text-with-dimensions("create-a-simple-text-reminder-always-free.png", 50%, 50%)

The image is properly located on /app/assets/images dir and it can be accessed directly through localhost:3000/assets/create-a-simple-text-reminder-always-free.png. I just ran bundle update so I'm running the latest compass-rails gem. Doesn anyone have a clue as to what is happening here? I'm really having a lot of trouble getting Compass to work, there are a lot of hacks/fixes.

Thanks!

Can't set more than one images_dir path for Rails engines

I'm using Rails engines to separate my app into smaller blocks. The issue is that image and inline-image helpers look in Compass.configuration.images_dir path, but every engine has its own images, so it would be awesome if one could provide an array instead of a string as images_dir value.

By default Compass looks at app/assets/images, but I'd like to add other paths like engines/my_engine/app/assets/images etc.

Automatic compilation in a custom Rails environment

Hi,

Sorry of this was reported before but I tried searching both compas-rails and compas issues and couldn't find similar question.

I'm still new to using compass/sass in a rails application (Rails 3.0.9) .. I have a multiple custom environments other than development and I couldn't get my scss files compiled with browser's refresh when I've made changes to the scss files.

Do I miss some configuration here?

Unable to append to sprite_load_path

I'm having trouble modifying the sprite_load_path config option.

I've tried to append an element to Compass.configuration.sprite_load_path in several ways, but when SpriteImporter#files is called, the Compass.configuration.sprite_load_path is always the original 1-element array.

I'm actually developing a Rails plugin, and want to add its app/assets/images directory to the sprite_load_path. I've tried doing that in the plugin's config/initializers/compass.rb:

Rails.application.config.compass.sprite_load_path << File.expand_path('../../../app/assets/images', __FILE__)

I've tried moving this initializer file to the Rails application's config/initializers directory.

Then, I've modified the application's config/application.rb and added the following to the class:

    config.compass.sprite_load_path << File.expand_path('../../../../my-plugin/app/assets/images', __FILE__)

I can confirm that the configuration is modified in each case right after I modify it (inspecting Compass.configuration.sprite_load_path.to_a shows my desired second path).

It seems that the original Compass.configuration object and the one used inside SpriteImporter#files are two different objects (I inspected their object_ids). I could not figure out how the Compass.configuration object gets replaced after my initialization.

Can you help me out somehow? How can I modify this setting from within the plugin?

Maybe an even better option would be to automatically append all assets/images paths of all Rails engines and plugins?

`<module:Sprockets>': uninitialized constant Rails (NameError)

In Rails 3.1.0

rails new compassrails
cd compassrails

add gem 'compass-rails' to assets as said in README, then run bundle

bundle exec compass init explodes

Stacktrace:

bundle exec compass init
/Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/actionpack-3.1.0/lib/sprockets/railtie.rb:7:in `<module:Sprockets>': uninitialized constant Rails (NameError)
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/actionpack-3.1.0/lib/sprockets/railtie.rb:1:in `<top (required)>'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass/rails/railtie.rb:1:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass/rails/railtie.rb:1:in `<top (required)>'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass/rails.rb:8:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass/rails.rb:8:in `<top (required)>'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass-rails.rb:1:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/sass-rails-3.1.5/lib/sass-rails.rb:1:in `<top (required)>'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `each'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `each'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.14/lib/bundler.rb:120:in `require'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/gems/compass-0.12.rc.0/bin/compass:25:in `<top (required)>'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/bin/compass:19:in `load'
    from /Users/eumir/.rvm/gems/ruby-1.9.2-p180@bayanihand/bin/compass:19:in `<main>'

How to use PIE with Compass on rails?

I can`t understand after reading documentation and looking through similar issues, how to use PIE with compass on rails.

@import compass/css3/pie and what next?

Could you please provide a step by step instruction how to add a simple mixing to an element to get it work in IE? Thanks in advance!

Problems importing Susy into Rails project using Compass-Rails

I've started a new rails project using the following gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.8'

group :development do
  gem 'sqlite3'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'compass-rails'
  gem 'susy'
  gem 'sassy-buttons'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'devise'

I then attempt to @import "susy"; into my application.css.scss file but it fails with the following error:

Sass::SyntaxError in Devise/sessions#new

Showing /Users/ashleyconnor/Development/rails/myapp/app/views/layouts/application.html.erb where line #5 raised:

File to import not found or unreadable: susy.
Load paths:
  Sass::Rails::Importer(/Users/ashleyconnor/Development/rails/myapp/app/assets/stylesheets/application.css.scss)
  /Users/ashleyconnor/Development/rails/myapp/app/assets/stylesheets
  /Users/ashleyconnor/.rvm/gems/ruby-1.9.3-p194@myapp/gems/compass-0.12.2/frameworks/blueprint/stylesheets
  /Users/ashleyconnor/.rvm/gems/ruby-1.9.3-p194@myapp/gems/compass-0.12.2/frameworks/compass/stylesheets
  /Users/ashleyconnor/.rvm/gems/ruby-1.9.3-p194@myapp/gems/compass_twitter_bootstrap-2.0.3/stylesheets
  /Users/ashleyconnor/.rvm/gems/ruby-1.9.3-p194@myapp/gems/sassy-buttons-0.1.4/stylesheets
  Compass::SpriteImporter
  (in /Users/ashleyconnor/Development/rails/myapp/app/assets/stylesheets/application.css.scss)

Importing sassy-buttons works but susy doesn't for some reason.

Compass cannot be found in production environment

I am trying to compile some assets during runtime using the following code:

Sprockets::StaticCompiler.new(
  Rails.application.assets,
  File.join(Rails.public_path, Rails.application.config.assets.prefix),
  Array("my_asset.css"),
  :digest   => false,
  :manifest => false
).compile

my_asset.css.scss:

@import "compass/typography/text/replacement";
.something { @include replace-text-with-dimensions("my_image.png"); }

It works great in development, but in production I get an error:

Sass::SyntaxError: File to import not found or unreadable: compass/typography/text/replacement.
Load path: /home/rails/myapp/releases/20120313170102
    from /home/rails/myapp/releases/20120313170102/app/assets/stylesheets/my_asset.css.scss:1

My first reaction was to require 'compass' before calling Sprockets::StaticCompiler.new but that lead to

NameError: uninitialized constant Sass::Util
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/haml-3.1.4/lib/sass/plugin.rb:7:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/haml-3.1.4/lib/sass/rails3_shim.rb:15:in `block in <top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/haml-3.1.4/lib/sass/rails3_shim.rb:13:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/sass-3.1.15/lib/sass.rb:19:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/sass-3.1.15/lib/sass/version.rb:3:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/haml-3.1.4/lib/haml/util.rb:347:in `try_sass'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/haml-3.1.4/lib/sass.rb:6:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/compass-0.12.0/lib/compass/dependencies.rb:2:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/compass-0.12.0/lib/compass.rb:5:in `block in <top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/compass-0.12.0/lib/compass.rb:4:in `each'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/compass-0.12.0/lib/compass.rb:4:in `<top (required)>'
    from /home/rails/myapp/shared/bundle/ruby/1.9.1/gems/compass-0.12.0/lib/compass/rails.rb:2:in `<top (required)>'
    from /home/rails/myapp/releases/20120313170102/lib/foo.rb:1:in `<top (required)>'

foo.rb:1 is where I require 'compass'.

I dug around in Haml, Sass, Compass and Sprockets for a solution, but it feels like I'm missing something obvious here...

UPDATE:

When I add

require 'sass/rails'
require 'compass'

on top, the NameError: uninitialized constant Sass::Util doesn't happen, but the Sass::SyntaxError: File to import not found or unreadable: compass/typography/text/replacement. still happens when Sprockets::StaticCompiler.new(...).compile is called.

Sprite error: NoMethodError: undefined method `[]' for nil:NilClass

Hi,

Please help. I have this when trying to generate sprites:

NoMethodError: undefined method `[]' for nil:NilClass

I have sprites in app/assets/images/sprites/desktop/
Imported this way: @import "sprites/desktop/*.png";

Versions:
Rails 3.2.8
compass (0.12.2)
compass-rails (1.0.3)

RAILS_ROOT:

RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)

compass.rb

project_type = :rails
project_path = RAILS_ROOT if defined?(RAILS_ROOT)
line_comments = false
output_style = (Rails.env.production?) ? :compressed : :expanded
relative_assets = true

sass_options = {
  :unix_newlines => true
}

Full Backtrace (content of CSS file):

/*
NoMethodError: undefined method `[]' for nil:NilClass

Backtrace:
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-rails-3.2.5/lib/sass/rails/helpers.rb:32:in `resolver'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-rails-3.2.5/lib/sass/rails/helpers.rb:36:in `public_path'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-rails-3.2.5/lib/sass/rails/helpers.rb:15:in `asset_url'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/compass-rails-1.0.3/lib/compass-rails/patches/3_1.rb:5:in `generated_image_url'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/compass-0.12.2/lib/compass/sass_extensions/functions/sprites.rb:123:in `sprite_url'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/compass-0.12.2/lib/compass/sass_extensions/sprites/sprite_map.rb:72:in `method_missing'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/compass-0.12.2/lib/compass/sass_extensions/sprites/sprite_map.rb:63:in `to_s'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/script/list.rb:44:in `block in to_s'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/script/list.rb:44:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/script/list.rb:44:in `to_s'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:297:in `visit_prop'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:107:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:119:in `with_environment'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:106:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `block in visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:318:in `visit_rule'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:107:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:119:in `with_environment'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:106:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `block in visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:203:in `visit_if'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:206:in `visit_if'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `block in visit_import'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `visit_import'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `block in visit_import'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:225:in `visit_import'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `map'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:53:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:107:in `block in visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:119:in `with_environment'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:106:in `visit_children'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `block in visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:126:in `visit_root'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/base.rb:37:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:98:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/visitors/perform.rb:7:in `visit'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/tree/root_node.rb:20:in `render'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/engine.rb:315:in `_render'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/engine.rb:263:in `block in render'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/util.rb:371:in `silence_sass_warnings'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/engine.rb:263:in `render'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin/compiler.rb:340:in `update_stylesheet'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin/compiler.rb:202:in `block in update_stylesheets'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin/compiler.rb:200:in `each'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin/compiler.rb:200:in `update_stylesheets'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin.rb:81:in `update_stylesheets'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin.rb:54:in `check_for_updates'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/sass-3.2.2/lib/sass/plugin/rack.rb:51:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__520423418062779489__call__2101148808974438899__callbacks'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
/Users/krzysiek/.rvm/gems/ruby-1.9.3-head/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/Users/krzysiek/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/krzysiek/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/krzysiek/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
*/
body:before {
  white-space: pre;
  font-family: monospace;
  content: "NoMethodError: undefined method `[]' for nil:NilClass"; }

stack level too deep on many images being combined to sprites

icons.css.scss

@import "icons/*.png";
@include all-icons-sprites;

application.css.scss

@import "compass";
@import "icons";

If icons/*.png expands to many files (in my case exactly 1000), I get
stack level too deep
sprockets (2.1.2) lib/sprockets/context.rb:180

Looking at that line, I guess the problem is in some sprockets processor ?

When I reduce the number of files in images/icons, the exception disappears.

Cheers,
Paul

Note about existing configuration files

I had a little hiccup in updating an existing Rails project. I was following the update instructions that says "First and foremost, follow the installation instructions above." I think this could be clearer.

The installation instructions say to execute

$ bundle exec compass init

That was a little deceiving to me because I already had a compass config file that was causing anything from bundle exec compass to fail with a big stack trace, shown here

$ bundle exec compass init
./config/compass.rb:4:in `get_binding': uninitialized constant Compass::AppIntegration::Rails (NameError)
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/serialization.rb:24:in `eval'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/serialization.rb:24:in `parse_string'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/serialization.rb:15:in `block in _parse'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/serialization.rb:14:in `open'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/serialization.rb:14:in `_parse'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/file_data.rb:7:in `block in new_from_file'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/inheritance.rb:204:in `with_defaults'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/file_data.rb:6:in `new_from_file'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/lib/compass/configuration/helpers.rb:42:in `configuration_for'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-rails-1.0.0.rc.1/lib/compass-rails.rb:183:in `boot_config'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-rails-1.0.0.rc.1/lib/compass-rails.rb:201:in `<top (required)>'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/gems/compass-0.12.rc.0/bin/compass:25:in `<top (required)>'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/bin/compass:19:in `load'
    from /Users/rick/.rubies/1.9.3-p0/lib/ruby/gems/1.9.1/bin/compass:19:in `<main>'

It was being caused by these two lines in my existing compass config:

project_path = Compass::AppIntegration::Rails.root
environment = Compass::AppIntegration::Rails.env

I think it would be more helpful for people upgrading to explain in the "Upgrade" section of the README that the previous configuration options aren't all needed, and they can replace most of it with just

# Require any additional compass plugins here.                                  
project_type = :rails

Other than that, compass-rails = so easy. So much better. Thank you.

Watch with Rails?

I'm currently using compass-rails only for the sprite functionality, but I can't seem to figure out how to get it to recompile when an image has changed.

Removing the sprites file does not seem to work. It certainly causes compass to recompile the sprites file (with a new hash), but doesn't update the CSS files, resulting in a 404 and blank icons.

Presumably there's something I need to set in config/compass.rb?

Any help would be appreciated.

New files get ignored

Scenario:

  • Rails 3.2 project.

  • My stylesheet includes this line:

    @import "core/pages/*"
    
  • Adding a new file core/pages/x.sass has no effect.

  • Adding this line to my stylesheet causes x to be noticed:

    @import "core/pages/x"
    
  • x will continue to be paid attention to after this, even if the line in the previous step is removed.

Neither rake tmp:clear nor rake assets:clean seem to have no effect on the above.

Neither does modifying the main stylesheet in a trivial way (like adding whitespace or touch-ing).

Is there any way I can tell compass-rails, doing its asset-pipeline magic, to force update?

compass not importing extension in some files

This looks a bit odd to me.

I'm using Rails 3.2.3 with compass-rails 1.8.6 on Cedar stack.

Extensions are working fine in Heroku when importing them in the .sass files main "application" folder.

I have created a second stylesheet folder in /app/assets/stylesheets/mobile and a /app/assets/stylesheets/mobile.scss file.

In dev mode everything works fine but on Heroku it doesn't recognize the extensions for files inside this folder. It is looking weird because it seems to be working fine for the application folder files.

2012-05-02T01:42:36+00:00 app[web.1]: Load path: /app
2012-05-02T01:42:36+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: compass/css3/box-shadow.
2012-05-02T01:42:36+00:00 app[web.1]:   (in /app/app/assets/stylesheets/mobile/header.css.sass)):

#app/assets/stylesheets/mobile/header.css.sass
@import "compass/css3/box-shadow"

# Gemfile
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'compass-rails'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

Not picking up mixins etc from other partials

Ok this is my setup.

Rails 3.2.3

'sass-rails', '~> 3.2.3'
'compass-rails'

I've got a main file 'screen.css.scss' which looks like this


@import "compass/css3";
@import "h5bp";
@include h5bp-helpers;
@include h5bp-chromeframe;
@include h5bp-normalize;
@include h5bp-media;

@import "partials/base";
@import "partials/page";

My base partial looks like this

// This file must be imported before loading html5-boilerplate

// fonts
$font-family: sans-serif;
$font-color: #000;

// structure
$page-width: 986px;

//colors
$brand: #ffde00;
$link: #00a6e3;

However my page partial can't see any of those variables. I've also had to @import compass/css3 in the page partial as it can't find them even though they are @imported in the screen.css.scss file.

Am I being really dim here?

Thanks

John

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.