Reputation: 7990
I am having trouble compiling individual stylesheets using Compass. I am able to use compass compile
to do all the files, and compass watch
to monitor for changes. But when I try to assign a particular file to compass compile
, I get get following error:
Individual stylesheets must be in the sass directory
My directory structure:
project root
- util
-- compass
--- config.rb
- www
-- css
--- [destination for .css files]
-- sass
--- [.scss files]
My config.rb:
project_type = :stand_alone
# Set this to the root of your project when deployed:
project_path = "../../"
http_path = "www" # The path to the project when running within the web server.
css_dir = "www/css" # relative to project_path
sass_dir = "www/sass" # relative to project_path
images_dir = "www/images" # relative to project_path
javascripts_dir = "www/js" # relative to project_path
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true
# generate sourcemaps
sourcemap = true
The following work fine when run from the /util/compass
folder:
compass compile
compass watch
These do not work:
compass compile builder.scss
compass compile ../../www/sass/builder.scss
compass compile www/sass/builder.scss
and cause the error which presumably means the scss file cannot be found.
What am I doing wrong?
Upvotes: 1
Views: 540
Reputation: 6347
This is not a perfect solution, but at least gets you going. Probably this is caused by some bug in compass which leads to invalid sass_path
. So set the sass_path
manually like this:
project_type = :stand_alone
# Set this to the root of your project when deployed:
project_path = "../../"
http_path = "www" # The path to the project when running within the web server.
css_dir = "www/css" # relative to project_path
sass_dir = "www/sass" # relative to project_path
sass_path = File.expand_path(File.join(project_path, sass_dir))
images_dir = "www/images" # relative to project_path
javascripts_dir = "www/js" # relative to project_path
# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compressed
# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true
# generate sourcemaps
sourcemap = true
And then you should be able to build individual sass files by using command compass compile ../../www/sass/builder.scss
Upvotes: 2