Importing an scss file from outside of the stylesheets folder

Hello, another question!

Is it possible to have a scss file outside of the normal stylesheets directory and compile to that location?

Many thanks

Hi ottobyte,

You can change the location of the stylesheet source directory easily enough, by altering the stylesheets_dir setting in your config.rb.

I think you’re asking, though, whether you can have multiple stylesheet source directories. Something like:

source
    - stylesheets
        - a.css
    - alternative
        - b.css

And you want to end up with a build that looks like:

build
    - stylesheets
        - a.css
    - alternative
        - b.css

Is that right?

Exactly!

I’m really hoping this is possible…!

Thankyou!

Michael

Hi there, I’ve been looking at options for this one, but alas I haven’t found anything so far. Does anyone have any ideas?

I’ve managed it. By setting it to the root of the source folder like so:

set :css_dir, '.'

And then when importing Sass partials/css etc I can do:

@import "core/assets/css/common";
@import "somefolder/somemodule/somemodule";

Where the directory stucture is

source/  
    - core/
        - assets/
          - css/
            - _common.scss
    - somefolder/
        - somemodule/
           - _somemodule.scss

Works for me. Anybody see any problems with that?

Thanks for that, much appreciated!
Kind regards

I have noticed issues doing it that way with the built in css minify, I ended up doing this in the build section of the config:

configure :build do	

	compass_config do |config|
	    config.sass_options = {:debug_info => false }
	    config.sass_options = {:line_comments => false}
	    config.sass_options = {:style => :compressed }
 	end

	# For example, change the Compass output style for deployment
	# activate :minify_css

end
  • Commented out the :minify_css and just used the Sass compressed which is good enough for me, for now.

How about serving stylesheets from outside the root? E.g. what is normally the ‘source’ folder. I would like to keep my stylesheet outside of the source folder.