Merge pull request #536 from kematzy/fix-sass-cache-location

Fix sass cache location
This commit is contained in:
Thomas Reynolds 2012-07-16 22:14:05 -07:00
commit 6f0f9b00a2
7 changed files with 42 additions and 1 deletions

View file

@ -14,6 +14,11 @@ module Middleman
# Default sass options
app.set :sass, {}
# Location of SASS .sass_cache directory.
# @return [String]
# set :sass_cache_path, "/tmp/middleman-app-name/sass_cache"
app.set(:sass_cache_path) { File.join(app.root_path, '.sass_cache') } # runtime compile of path
app.before_configuration do
template_extensions :scss => :css,
:sass => :css

View file

@ -0,0 +1,22 @@
Feature: SASS .sass_cache custom location
Scenario: Using the default location for .sass_cache folder
Given the Server is running at "sass-cache-path-default-app"
When I go to "/stylesheets/plain.css"
Then I should see "color: blue;"
# TODO::
# Not sure how to test this location, as the directory is stored outside of the app root
# during testing, but inside app root in "production"
# Then a directory named ".sass_cache" should exist
Scenario: Using a custom location for .sass_cache folder
Given the Server is running at "sass-cache-path-custom-app"
When I go to "/stylesheets/plain.css"
Then I should see "html, body, div, span, applet, object, iframe,"
Then a directory named "/tmp/middleman-more-custom-sass_cache_path" should exist

View file

@ -0,0 +1,3 @@
set :sass_cache_path, File.join('/tmp', "#{File.basename(Dir.pwd)}-custom-sass_cache_path")

View file

@ -0,0 +1,4 @@
@import "compass/reset"
red
color: blue

View file

@ -0,0 +1,3 @@
# Using default setting
# set :sass_cache_path, File.join(Dir.pwd, '.sass_cache')

View file

@ -0,0 +1,4 @@
@import "compass/reset"
red
color: blue

View file

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