Added :sass_cache_path custom config of SASS cache directory

The default output of SASS .sass_cache directory is in the Middleman app root directory, which to my mind adds clutter to the directory.

Secondly, when storing Middleman apps in a Dropbox subfolder, the .sass_cache directory gets synced unnecessarily.

This fix enables moving the .sass_cache directory to any path on the system, such as the "/tmp" directory for automatic discarding of files when restarting the system.

Suggested usage:

    #in config.rb
    set :sass_cache_path, File.join('/tmp', "middleman-#{File.basename(Dir.pwd)}", "sass_cache")

which could return something like:

    `/tmp/middleman-example.com/sass_cache`

This keeps multiple projects separated and easily identifiable.
This commit is contained in:
kematzy 2012-07-16 14:34:36 +08:00
parent 5c9a5c9849
commit 1de1d3d25e
2 changed files with 6 additions and 1 deletions

View file

@ -101,6 +101,11 @@ module Middleman
# @return [String] # @return [String]
set :css_dir, "stylesheets" set :css_dir, "stylesheets"
# Location of SASS .sass_cache directory.
# @return [String]
# set :sass_cache_path, "/tmp/middleman-app-name/sass_cache"
set(:sass_cache_path) { File.join(root_path, '.sass_cache') } # runtime compile of path
# Location of images within source. Used by HTML helpers and Compass. # Location of images within source. Used by HTML helpers and Compass.
# @return [String] # @return [String]
set :images_dir, "images" set :images_dir, "images"

View file

@ -21,7 +21,7 @@ module Middleman
::Compass.configuration do |config| ::Compass.configuration do |config|
config.project_path = source_dir config.project_path = source_dir
config.environment = :development config.environment = :development
config.cache_path = File.join(root, ".sass-cache") config.cache_path = sass_cache_path
config.sass_dir = css_dir config.sass_dir = css_dir
config.css_dir = css_dir config.css_dir = css_dir
config.javascripts_dir = js_dir config.javascripts_dir = js_dir