diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index dcf9bf1e..68ad2623 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -109,6 +109,11 @@ module Middleman # @return [String] set :css_dir, "stylesheets" + # Location of SASS/SCSS files external to source directory. + # @return [Array] + # set :sass_assets_paths, ["#{root}/assets/sass/", "/path/2/external/sass/repository/"] + set :sass_assets_paths, [] + # Location of images within source. Used by HTML helpers and Compass. # @return [String] set :images_dir, "images" diff --git a/middleman-more/features/sass-assets-paths.feature b/middleman-more/features/sass-assets-paths.feature new file mode 100644 index 00000000..a28baae9 --- /dev/null +++ b/middleman-more/features/sass-assets-paths.feature @@ -0,0 +1,11 @@ +Feature: Support SASS assets paths + In order to import common shared assets when writing Sass + + Scenario: Importing assets from 'assets/stylesheets/' directory in app root + Given the Server is running at "sass-assets-path-app" + When I go to "/stylesheets/plain.css" + Then I should see "color: green;" + Then I should see "/* Works with shared SCSS assets from APPROOT/assets/stylesheets/_shared-asset.scss */" + Then I should see "/* Works with shared SASS assets from APPROOT/assets/stylesheets/_shared-asset.sass */" + Then I should see "font-size: 18px" + Then I should see "/* Works with shared SASS assets from external source directory */" diff --git a/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.sass b/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.sass new file mode 100644 index 00000000..cb909705 --- /dev/null +++ b/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.sass @@ -0,0 +1 @@ +/* Works with shared SASS assets from APPROOT/assets/stylesheets/_shared-asset.sass */ diff --git a/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.scss b/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.scss new file mode 100755 index 00000000..c3708ac2 --- /dev/null +++ b/middleman-more/fixtures/sass-assets-path-app/assets/stylesheets/_shared-asset.scss @@ -0,0 +1 @@ +/* Works with shared SCSS assets from APPROOT/assets/stylesheets/_shared-asset.scss */ \ No newline at end of file diff --git a/middleman-more/fixtures/sass-assets-path-app/config.rb b/middleman-more/fixtures/sass-assets-path-app/config.rb new file mode 100644 index 00000000..3b1bc2c1 --- /dev/null +++ b/middleman-more/fixtures/sass-assets-path-app/config.rb @@ -0,0 +1,6 @@ + +set :sass_assets_paths, [ + "#{root}/assets/stylesheets/", + # load from another app within gem source + "#{File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))}/fixtures/preview-app/source/stylesheets/" +] \ No newline at end of file diff --git a/middleman-more/fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass b/middleman-more/fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass new file mode 100644 index 00000000..2c6d731b --- /dev/null +++ b/middleman-more/fixtures/sass-assets-path-app/source/stylesheets/plain.css.sass @@ -0,0 +1,16 @@ + +red + color: green + +/* imports below + +// SCSS with extension +@import "_shared-asset.scss" + +// without extension +@import "shared-asset" + +// imported from outside of local 'assets/' directory +@import "_partial.sass" + +/* Works with shared SASS assets from external source directory */ diff --git a/middleman-more/lib/middleman-more/core_extensions/compass.rb b/middleman-more/lib/middleman-more/core_extensions/compass.rb index 2735fb08..98e2ac57 100644 --- a/middleman-more/lib/middleman-more/core_extensions/compass.rb +++ b/middleman-more/lib/middleman-more/core_extensions/compass.rb @@ -23,6 +23,7 @@ module Middleman config.environment = :development config.cache_path = sass_cache_path config.sass_dir = css_dir + config.additional_import_paths = sass_assets_paths config.css_dir = css_dir config.javascripts_dir = js_dir config.fonts_dir = fonts_dir