stylesheets not automatically recompiling on page refresh

50 views
Skip to first unread message

Bill Burcham

unread,
Aug 18, 2009, 9:48:44 PM8/18/09
to Compass
Just added Compass CSS and 960gs to a Rails 2.3.2 project and almost
everything is perfect except that compass isn't automatically
recompiling (.sass) files when a page is refreshed.

These say it should be automatic (on a page refresh):

http://wiki.github.com/chriseppstein/compass-960-plugin
http://github.com/chriseppstein/compass-rails-sample-application/tree/master

I have to run compass whenever I change .sass source. I don't mind but
the other folks on my project do. How should I debug this issue?

Chris Eppstein

unread,
Aug 18, 2009, 10:52:54 PM8/18/09
to compas...@googlegroups.com
That's very strange. Are you sure you specified --rails when
installing? If you did, you would have a config/compass.config instead
of a config.rb file at the top of your project.

Hunt & pecked on my iPhone... Sorry if it's brief!

On Aug 18, 2009, at 6:48 PM, Bill Burcham <bill.b...@gmail.com>
wrote:

Bill Burcham

unread,
Aug 19, 2009, 12:35:38 PM8/19/09
to Compass
I have a /config/compass.config (and no config.rb)

I have /vendor/plugins/haml

I have these gems added to the environment: chriseppstein-compass and
chriseppstein-compass-960-plugin

Is there a breakpoint I can set in a gem to see if the hook is
getting, well, hooked?

Bill Burcham

unread,
Aug 19, 2009, 12:48:49 PM8/19/09
to Compass
I verified that process_with_compass(*args) is called (in the Compass
Rails integration) when I refresh a page.

But changes to .sass files are still not automatically cause compass
to compile. (running compass manually works still)

Chris Eppstein

unread,
Aug 19, 2009, 1:42:51 PM8/19/09
to compas...@googlegroups.com
Bizarre. The only thing that comes to mind is that Sass is configured to not recompile. Can you inspect the runtime value of Sass::Plugin.options and send me that?

Chris

Bill Burcham

unread,
Aug 19, 2009, 7:11:30 PM8/19/09
to Compass
inside monkey-patched ActionController::Base::process (in /vendor/gems/
haml-2.3.0/lib/sass/plugin/rails.rb)

{:template_location=>"/Users/Bill/Projects/Rails/ypm/public/
stylesheets/sass", :css_location=>"/Users/Bill/Projects/Rails/ypm/
public/stylesheets", :cache_location=>"/Users/Bill/Projects/Rails/ypm/
tmp/sass-
cache", :always_update=>false, :always_check=>true, :full_exception=>true}

Um and those are wrong.

So the HAML plugin isn't getting my configuration (at least not at
that point in the execution). Here's the contents of /Users/Bill/
Projects/Rails/ypm/config/compass.config:

# Require any additional compass plugins here.
project_type = :rails
project_path = RAILS_ROOT if defined?(RAILS_ROOT)
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "public/stylesheets/compiled"
sass_dir = "app/stylesheets"
images_dir = "public/images"
javascripts_dir = "public/javascripts"
# To enable relative paths to assets via compass helper functions.
Uncomment:
# relative_assets = true
http_images_path = "/images"
http_stylesheets_path = "/stylesheets"
http_javascripts_path = "/javascripts"

Chris Eppstein

unread,
Aug 19, 2009, 7:31:46 PM8/19/09
to compas...@googlegroups.com
Now we're getting somewhere.

Is your compass initializer being ran?

Did you run "haml --rails ." on your project?

chris

Bill Burcham

unread,
Aug 19, 2009, 7:41:51 PM8/19/09
to Compass
I think I did. I ran it again just now and got:

BillBurcham:ypm Bill$ haml --rails .
Directory ./vendor/plugins/haml already exists, overwrite [y/N]? n

Also just before that I ran this:

Bill$ compass -r ninesixty -f 960 .
exists .
exists ./app/stylesheets
exists ./public/stylesheets/compiled
create ./config.rb
identical ./app/stylesheets/grid.sass
identical ./app/stylesheets/text.sass
exists ./public/stylesheets/compiled
compile ./app/stylesheets/base_yp.sass
identical ./public/stylesheets/compiled/base_yp.css
compile ./app/stylesheets/grid.sass
identical ./public/stylesheets/compiled/grid.css
compile ./app/stylesheets/text.sass
identical ./public/stylesheets/compiled/text.css

Lookie, it created a config.rb (in the root of my rails project). But
isn't the Compass config supposed to be in /config/compass.config? I
have the latter, but who/what reads that thing?

Chris Eppstein

unread,
Aug 19, 2009, 7:48:32 PM8/19/09
to compas...@googlegroups.com
compass requires --rails when install into a rails project.

Bill Burcham

unread,
Aug 19, 2009, 8:31:47 PM8/19/09
to Compass
ah so!

BillBurcham:ypm Bill$ compass --force --rails -r ninesixty -f 960 .
exists ./app/stylesheets
exists ./public/stylesheets/compiled
overwrite ./config/compass.config
create ./config/initializers/compass.rb
identical ./app/stylesheets/grid.sass
identical ./app/stylesheets/text.sass

Looks like everything works now. Um I do notice one small issue at the
top of the generated compass.config:

require 'ninesixty'
require 'ninesixty'
# Require any additional compass plugins here.
...

Require is duplicated.

Anyhow, thanks a million for all your help Chris!
Reply all
Reply to author
Forward
0 new messages