Search code examples
csssasscompass-sass

Compass Sass Pre-Processor project directory


I've recently started using compass as a sass pre-processor and am having an issue in regard to how it's reading my project directory path while in a XAMPP localhost environment.

my compass config.rb is below:

css_dir = "CSS" # by Compass.app 
sass_dir = "SASS" # by Compass.app 
images_dir = "IMG" # by Compass.app 

My problem: I've got a project in a sub directory of htdocs, and I'm trying to use the 'image-url' helper. When declaring image-url it renders to the css file like so

/IMG/imagename.png

in doing this, it refers back to the localhost root, not to the project directory. This is clearly an issue only on my local machine and once I push to production server shouldn't be a problem, but it's still an issue as I can't use that helper while developing the production code.

image src should be this: http://localhost/bliorg/IMG/header_fortify.png

but is rendering as this: http://localhost/IMG/header_fortify.png

notice that 'bliorg' is the actually project directory... it's a sub directory of localhost

my question:

Is it possible to declare the sub directory as my main project directory in the compass config file? Or am I completely missing the point?


Solution

  • I had to set "relative_assets = true" in config.rb for it to reference the sub directory path as the project root directory

    NOTE: In using the compass app, it doesn't seem to monitor manual changes to the config.rb file

    In order to override the config.rb file, I had to delete the config.rb file, open "Change Options" from the Compass app and check "Relative Assets" under Sass options.