Question

I don't know if I can explain the issue without pasting the whole code of all files but I'll try.

EDIT I've added the whole code to Github Account - My Sass structure

I use Windows 8.1 and Compass 0.12.6

In my public_html folder I have config.rb file and stylesheets folder. In stylesheets folder I have directory sass where I keep all sass files. CSS files are generated into stylesheets/preview folder (for development purposes) and into stylesheets folder (for production purposes).

I run compass watching running watch.bat script that I have in public_html folder

Content of watch.bat is:

START compass watch -c config.rb -e development
START compass watch -c config.rb -e production
EXIT

My config.rb file is:

require 'compass/import-once/activate'
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "../"

sass_dir = "stylesheets/sass"
images_dir = "img"
javascripts_dir = "js"
cache = false
relative_assets = true


add_import_path "stylesheets/sass"


if environment == :development
    css_dir = "stylesheets/preview"
    line_comments = true
    output_style = :nested
end

if environment == :production
    css_dir = "stylesheets"
    line_comments = false
    output_style = :compressed
end 

In stylsheets/sass I have 4 files print.scss , medium.scss, small.scss and large.scss

Both medium.scss and large.scss begin with:

@import "base/_init";

This file import partial _init from base folder and this one loads another partials and other partials load another partials.

The problem is when I change something in partial Compass doesn't always compile all necessary output files. For example I've just changed something in _settings.scss partial and this one is finally loaded by medium.scss and large.scss (I remind that those 2 files have the same beginning so they both should be compiled). Somehow only medium.scss file is being in fact watched and large.scss file is not compiled as it should be in this case.

I have had such situation just before. I stoped 2 watchers (CTRL + C and Y) and then run again my watch.bat not changing anything in files - just after running I have info:

Change detected at 15:51:33 to: large.scss overwrite stylesheets/preview/large.css Compass is polling for changes. Press Ctrl-C to Stop.

and

Change detected at 15:51:33 to: large.scss overwrite stylesheets/large.css Compass is polling for changes. Press Ctrl-C to Stop.

So in fact there was change that should be watched but somehow compass/sass doesn't always catch it.

Sometimes neither of 2 watchers catch changes and I have to stop them and once again run watch.bat so it's not very convenient to work that way.

Sometimes even happen that watchers are stopped (as I presed CTRL +C + y) but I haven't pressed anything and in cmd there's no question about closing visible. They've just stopped

Question: What could be wrong and how to fix it?

Was it helpful?

Solution

I've cloned and checked your project structure, and your problem is simply the unnecessary use of the Import Once plugin. If you comment the first line of your config.rb (where this plugin is activated), your stylesheets will be compiled normally. Each main scss file you have (large.css, medium.css, small.css) is rendered to a separated css file, and you're not repeating your imports for each one of these files.

Below is the sequence of your imports with the Import Once plugin disabled:

enter image description here

OTHER TIPS

I dont't know exactly how to solve your problem.

I think basically it's a bug or problem with two instances of compass running at the same time on the same folder.

But due to your environment, I have a suggestion that can do the trick for you.

Why, instead of having two folders with the assets, one for prod. and dev., you just keep one, for both dev. and prod.

What you can set on compass is to output css in the way you want for dev. and then pass that css through a yui filter (or whatever) for prod. This will minify all assets. If you are using symfony, you can use assetics, for instance. That's the way we do and works perfect. We don't use assetics for compass... that's another topic :D

If you don't use any framework or extra filters, you can alway manually dump the assets when this ones are ready for production.

This way you avoid using two compass instances at the same time and also to compile manually for every deploy on production.

I really think it have to do with having two instances of compass running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top