2
votes

I have my compiled .css files in multiple, diverse directories along my app, and the Sass compiler I was previously using simply compiled the .scss files to a .css file in whatever directory they were in.

Compass seems to require a single 'output' directory that you can configure, that all of your compiled .css files go to, and it only watches a single folder.

How do you tell Compass to simply compile to the location of the .scss file?

2

2 Answers

1
votes

Compass uses a ruby config file named config.rb. In it a user can set various paths for assets, the style of output, as well as the path for CSS output.

Documentation on the Compass website: http://compass-style.org/help/tutorials/configuration-reference/

This is a sample of what I typically use for projects, which compiles my CSS into a different place than the SCSS. If you wanted it to be in the same place, you could use . as the path (a single period) which would tell it to compile into the same directory as the directory that you watch with the command line.

# Set this to the root of your project when deployed:
http_path = "/www/"
sass_dir = "sass"
images_dir = "../www/lib/cssimgages"
javascripts_dir = "../www/lib/js"
fonts_dir = "../www/lib/fonts"
css_dir = "../www/lib/css"

# 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 = :compact

I do agree with some of the other comments, though. You HTTP requests should be kept as low as possible, probably only referring to one stylesheet for mobile-first styles and another for styles within media-queries. But that doesn't answer your question.

1
votes

Silly me (then). Compass does this as well. Just pick the highest parent folder for your project as the sass and css dirs in your config.rb file, and compass will recursively loop through and compile the css into sass in whatever directory it found it.

sass_options = {:cache_location => "./temp/.sass-cache"}
http_path = "/"
css_dir = "therootdirectory"
sass_dir = "therootdirectory"
images_dir = "therootdirectory/assets/images/sprites"
javascripts_dir = "javascripts"