Brad Heller
Brad Heller

Reputation: 95

Can I configure SASS such that the scss files aren't in the web root?

It looks like SASS by default exposes scss files which I find rather obnoxious. Is there a way to configure SASS to look for scss files in a folder that's not in the web root but compile them into the public/stylesheets folder?

Upvotes: 1

Views: 797

Answers (2)

Phunky
Phunky

Reputation: 481

Old question but it's actually simple to do, you just pass the directories through to sass instead of specific .scss like so;

sass --watch /location/to/you/scss/:/location/to/your/css

Then any changes to scss will be saved into your css directory and it will also follow the same structure of your scss directory.

Upvotes: 0

Jesse Wolgamott
Jesse Wolgamott

Reputation: 40277

Yes!

If you use Compass, then you'll have a file /config/compass.rb that'll look like the following. Here I have my sass files in app/stylesheets and saving compiled in tmp/stylesheets (to help with heroku deployments)

/config/compass.rb

# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
#project_path = RAILS_ROOT if defined?(RAILS_ROOT)
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "tmp/stylesheets"
sass_dir = "app/stylesheets"
environment = Compass::AppIntegration::Rails.env
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

Upvotes: 1

Related Questions