From 824a84ef2aa46ca2d000f225091fa6acd0997f7a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 02:06:20 -0800 Subject: [PATCH 01/13] Add support for Sass and SCSS. --- jekyll.gemspec | 1 + lib/jekyll.rb | 1 + lib/jekyll/converters/sass.rb | 18 ++++++++++++++++++ lib/jekyll/converters/scss.rb | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 lib/jekyll/converters/sass.rb create mode 100644 lib/jekyll/converters/scss.rb diff --git a/jekyll.gemspec b/jekyll.gemspec index 1608ce76..1a8f1c96 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -53,6 +53,7 @@ Gem::Specification.new do |s| s.add_development_dependency('jekyll_test_plugin') s.add_development_dependency('jekyll_test_plugin_malicious') s.add_development_dependency('rouge', '~> 1.3') + s.add_development_dependency('sass', '~> 3.2') # = MANIFEST = s.files = %w[ diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 4b45e2ba..02509040 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -27,6 +27,7 @@ require 'liquid' require 'maruku' require 'colorator' require 'toml' +require 'sass' # internal requires require 'jekyll/core_ext' diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb new file mode 100644 index 00000000..a5f34518 --- /dev/null +++ b/lib/jekyll/converters/sass.rb @@ -0,0 +1,18 @@ +module Jekyll + class Sass < Converter + safe true + priority :low + + def matches(ext) + ext =~ /^\.sass$/i + end + + def output_ext(ext) + ".css" + end + + def convert(content) + Sass.compile(content, :syntax => :sass) + end + end +end diff --git a/lib/jekyll/converters/scss.rb b/lib/jekyll/converters/scss.rb new file mode 100644 index 00000000..de7c097f --- /dev/null +++ b/lib/jekyll/converters/scss.rb @@ -0,0 +1,18 @@ +module Jekyll + class Sass < Converter + safe true + priority :low + + def matches(ext) + ext =~ /^\.sass$/i + end + + def output_ext(ext) + ".css" + end + + def convert(content) + Sass.compile(content, :syntax => :scss) + end + end +end From 4da722383181a799b98e70df2169be63d81da15a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 02:18:59 -0800 Subject: [PATCH 02/13] Fixes for Sass/SCSS converters. --- lib/jekyll/converters/sass.rb | 2 +- lib/jekyll/converters/scss.rb | 6 +++--- test/test_sass.rb | 20 ++++++++++++++++++++ test/test_scss.rb | 21 +++++++++++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 test/test_sass.rb create mode 100644 test/test_scss.rb diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index a5f34518..aacf2a86 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -12,7 +12,7 @@ module Jekyll end def convert(content) - Sass.compile(content, :syntax => :sass) + Object::Sass.compile(content, :syntax => :sass) end end end diff --git a/lib/jekyll/converters/scss.rb b/lib/jekyll/converters/scss.rb index de7c097f..27a4e85f 100644 --- a/lib/jekyll/converters/scss.rb +++ b/lib/jekyll/converters/scss.rb @@ -1,10 +1,10 @@ module Jekyll - class Sass < Converter + class Scss < Converter safe true priority :low def matches(ext) - ext =~ /^\.sass$/i + ext =~ /^\.scss$/i end def output_ext(ext) @@ -12,7 +12,7 @@ module Jekyll end def convert(content) - Sass.compile(content, :syntax => :scss) + ::Sass.compile(content, :syntax => :scss) end end end diff --git a/test/test_sass.rb b/test/test_sass.rb new file mode 100644 index 00000000..0fa44d21 --- /dev/null +++ b/test/test_sass.rb @@ -0,0 +1,20 @@ +require 'helper' + +class TestSass < Test::Unit::TestCase + context "converting sass" do + setup do + @content = <<-SASS +$font-stack: Helvetica, sans-serif +body + font-family: $font-stack + font-color: fuschia +SASS + @output = <<-CSS +body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } +CSS + end + should "produce CSS" do + assert_equal @output, Jekyll::Sass.new.convert(@content) + end + end +end diff --git a/test/test_scss.rb b/test/test_scss.rb new file mode 100644 index 00000000..dbc40d83 --- /dev/null +++ b/test/test_scss.rb @@ -0,0 +1,21 @@ +require 'helper' + +class TestSass < Test::Unit::TestCase + context "converting SCSS" do + setup do + @content = <<-SCSS +$font-stack: Helvetica, sans-serif; +body { + font-family: $font-stack; + font-color: fuschia; +} +SCSS + @output = <<-CSS +body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } +CSS + end + should "produce CSS" do + assert_equal @output, Jekyll::Scss.new.convert(@content) + end + end +end From daa0b76484453d6af038a2dc19a0833040ebefbe Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 14:44:00 -0800 Subject: [PATCH 03/13] Allow users to specify options for Sass. --- lib/jekyll/converters/sass.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index aacf2a86..6cb2ff67 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -11,8 +11,12 @@ module Jekyll ".css" end + def sass_build_configuration_options(overrides) + (@config["sass"] || {}).deep_merge(overrides) + end + def convert(content) - Object::Sass.compile(content, :syntax => :sass) + ::Sass.compile(content, sass_build_configuration_options({"syntax" => :sass})) end end end From 22d4e2aa9005305c727b9bc110af928d8eb78a6d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 14:58:17 -0800 Subject: [PATCH 04/13] Consolidate into one master 'Sass' converter. --- lib/jekyll/converters/sass.rb | 32 +++++++++++++++++++++++++++++--- lib/jekyll/converters/scss.rb | 18 ------------------ test/test_sass.rb | 18 ++++++++++++++++++ test/test_scss.rb | 21 --------------------- 4 files changed, 47 insertions(+), 42 deletions(-) delete mode 100644 lib/jekyll/converters/scss.rb delete mode 100644 test/test_scss.rb diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index 6cb2ff67..177b62e6 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -4,7 +4,7 @@ module Jekyll priority :low def matches(ext) - ext =~ /^\.sass$/i + ext =~ /^\.s(a|c)ss$/i end def output_ext(ext) @@ -12,11 +12,37 @@ module Jekyll end def sass_build_configuration_options(overrides) - (@config["sass"] || {}).deep_merge(overrides) + (@config["sass"] || {}).deep_merge(overrides).symbolize_keys + end + + def syntax_type_of_content(content) + if content.include?(";") || content.include?("{") + :scss + else + :sass + end + end + + def sass_dir + @config["source"]["sass"]["sass_dir"] || "_sass" + end + + def sass_dir_relative_to_site_source + File.join( + @config["source"], + File.expand_path("/", sass_dir) + ) end def convert(content) - ::Sass.compile(content, sass_build_configuration_options({"syntax" => :sass})) + syntax = syntax_type_of_content(content) + configs = sass_build_configuration_options({ + "syntax" => syntax_type_of_content(content), + "cache" => false, + "filesystem_importer" => NilClass, + "load_paths" => sass_dir_relative_to_site_source + }) + ::Sass.compile(content, configs) end end end diff --git a/lib/jekyll/converters/scss.rb b/lib/jekyll/converters/scss.rb deleted file mode 100644 index 27a4e85f..00000000 --- a/lib/jekyll/converters/scss.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Jekyll - class Scss < Converter - safe true - priority :low - - def matches(ext) - ext =~ /^\.scss$/i - end - - def output_ext(ext) - ".css" - end - - def convert(content) - ::Sass.compile(content, :syntax => :scss) - end - end -end diff --git a/test/test_sass.rb b/test/test_sass.rb index 0fa44d21..aa57f874 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -11,6 +11,24 @@ body SASS @output = <<-CSS body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } +CSS + end + should "produce CSS" do + assert_equal @output, Jekyll::Sass.new.convert(@content) + end + end + + context "converting SCSS" do + setup do + @content = <<-SCSS +$font-stack: Helvetica, sans-serif; +body { + font-family: $font-stack; + font-color: fuschia; +} +SCSS + @output = <<-CSS +body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } CSS end should "produce CSS" do diff --git a/test/test_scss.rb b/test/test_scss.rb deleted file mode 100644 index dbc40d83..00000000 --- a/test/test_scss.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'helper' - -class TestSass < Test::Unit::TestCase - context "converting SCSS" do - setup do - @content = <<-SCSS -$font-stack: Helvetica, sans-serif; -body { - font-family: $font-stack; - font-color: fuschia; -} -SCSS - @output = <<-CSS -body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } -CSS - end - should "produce CSS" do - assert_equal @output, Jekyll::Scss.new.convert(@content) - end - end -end From 4784d1de184cf8c50441fbb5ea4c566d536287c0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 15:28:53 -0800 Subject: [PATCH 05/13] Build Sass configuration options. --- lib/jekyll/converters/sass.rb | 23 ++++++---- test/test_sass.rb | 85 ++++++++++++++++++++++++++++------- 2 files changed, 84 insertions(+), 24 deletions(-) diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index 177b62e6..424a1fbc 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -11,8 +11,12 @@ module Jekyll ".css" end + def user_sass_configs + @config["sass"] || {} + end + def sass_build_configuration_options(overrides) - (@config["sass"] || {}).deep_merge(overrides).symbolize_keys + user_sass_configs.deep_merge(overrides).symbolize_keys end def syntax_type_of_content(content) @@ -24,25 +28,26 @@ module Jekyll end def sass_dir - @config["source"]["sass"]["sass_dir"] || "_sass" + user_sass_configs["sass_dir"] || "_sass" end def sass_dir_relative_to_site_source File.join( @config["source"], - File.expand_path("/", sass_dir) + File.expand_path(sass_dir, "/") ) end - def convert(content) - syntax = syntax_type_of_content(content) - configs = sass_build_configuration_options({ + def sass_configs(content = "") + sass_build_configuration_options({ "syntax" => syntax_type_of_content(content), "cache" => false, - "filesystem_importer" => NilClass, - "load_paths" => sass_dir_relative_to_site_source + "load_paths" => [sass_dir_relative_to_site_source] }) - ::Sass.compile(content, configs) + end + + def convert(content) + ::Sass.compile(content, sass_configs(content)) end end end diff --git a/test/test_sass.rb b/test/test_sass.rb index aa57f874..5e32b5cc 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -1,38 +1,93 @@ require 'helper' class TestSass < Test::Unit::TestCase - context "converting sass" do - setup do - @content = <<-SASS + def site_configuration(overrides = {}) + Jekyll::Configuration::DEFAULTS.deep_merge(overrides).deep_merge({ + "source" => source_dir, + "destination" => dest_dir + }) + end + + def converter(overrides = {}) + Jekyll::Sass.new(site_configuration({"sass" => overrides})) + end + + def sass_content + <<-SASS $font-stack: Helvetica, sans-serif body font-family: $font-stack font-color: fuschia SASS - @output = <<-CSS -body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } -CSS - end - should "produce CSS" do - assert_equal @output, Jekyll::Sass.new.convert(@content) - end end - context "converting SCSS" do - setup do - @content = <<-SCSS + def scss_content + <<-SCSS $font-stack: Helvetica, sans-serif; body { font-family: $font-stack; font-color: fuschia; } SCSS - @output = <<-CSS + end + + def css_output + <<-CSS body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; } CSS + end + + context "matching file extensions" do + should "match .scss files" do + assert converter.matches(".scss") end + + should "match .sass files" do + assert converter.matches(".sass") + end + end + + context "determining the output file extension" do + should "output .css file extension" do + assert_equal ".css", converter.output_ext(".sass") + end + end + + context "when building configurations" do + should "not allow caching" do + assert_equal false, converter.sass_configs[:cache] + end + + should "set the load paths to the _sass dir relative to site source" do + assert_equal [source_dir("_sass")], converter.sass_configs[:load_paths] + end + + should "allow the user to specify a different sass dir" do + assert_equal [source_dir("_scss")], converter({"sass_dir" => "_scss"}).sass_configs[:load_paths] + end + + should "set syntax :scss when SCSS content" do + assert_equal :scss, converter.sass_configs(scss_content)[:syntax] + end + + should "set syntax :sass when Sass content" do + assert_equal :sass, converter.sass_configs(sass_content)[:syntax] + end + + should "default to :sass syntax when content is empty" do + assert_equal :sass, converter.sass_configs[:syntax] + end + end + + context "converting sass" do should "produce CSS" do - assert_equal @output, Jekyll::Sass.new.convert(@content) + assert_equal css_output, converter.convert(sass_content) + end + end + + context "converting SCSS" do + should "produce CSS" do + assert_equal css_output, converter.convert(scss_content) end end end From 8ecd2d9218c4ea7e9e92b29e1169e989b9461a5f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 15:37:09 -0800 Subject: [PATCH 06/13] Don't allow path traversal or syntax overrides. --- test/test_sass.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_sass.rb b/test/test_sass.rb index 5e32b5cc..46f55f13 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -77,6 +77,14 @@ CSS should "default to :sass syntax when content is empty" do assert_equal :sass, converter.sass_configs[:syntax] end + + should "not allow sass_dirs outside of site source" do + assert_equal source_dir("etc/passwd"), converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source + end + + should "override user-set syntax based on content" do + assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax] + end end context "converting sass" do From ecf85a9cfa830167cf3afe87d1361462a3424e39 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 15:38:26 -0800 Subject: [PATCH 07/13] Does not allow caching. This was done to prevent putting the .sass-cache folder in bad places. Needed? cc @benbalter. --- test/test_sass.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/test_sass.rb b/test/test_sass.rb index 46f55f13..bc49a227 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -85,6 +85,10 @@ CSS should "override user-set syntax based on content" do assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax] end + + should "override user-set cache setting" do + assert_equal false, converter("cache" => true).sass_configs[:cache] + end end context "converting sass" do From 66732b91c1e618e91dffc01903856773129efe12 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 15:39:17 -0800 Subject: [PATCH 08/13] Make sass a runtime dependency. --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 1a8f1c96..04a20e23 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -34,6 +34,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('colorator', "~> 0.1") s.add_runtime_dependency('redcarpet', "~> 3.0") s.add_runtime_dependency('toml', '~> 0.1.0') + s.add_runtime_dependency('sass', '~> 3.2') s.add_development_dependency('rake', "~> 10.1") s.add_development_dependency('rdoc', "~> 3.11") @@ -53,7 +54,6 @@ Gem::Specification.new do |s| s.add_development_dependency('jekyll_test_plugin') s.add_development_dependency('jekyll_test_plugin_malicious') s.add_development_dependency('rouge', '~> 1.3') - s.add_development_dependency('sass', '~> 3.2') # = MANIFEST = s.files = %w[ From 6b92126fd8f9634beeb68a100339c8d8bc151f04 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 21:28:54 -0800 Subject: [PATCH 09/13] Add docs for Sass conversion. --- site/_includes/docs_contents.html | 2 +- site/_includes/docs_contents_mobile.html | 2 +- site/docs/assets.md | 46 ++++++++++++++++++++++++ site/docs/datafiles.md | 10 +++--- site/docs/migrations.md | 2 +- 5 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 site/docs/assets.md diff --git a/site/_includes/docs_contents.html b/site/_includes/docs_contents.html index 523b5227..bed2a66c 100644 --- a/site/_includes/docs_contents.html +++ b/site/_includes/docs_contents.html @@ -3,7 +3,7 @@

Getting Started

{% include docs_ul.html items='home quickstart installation usage structure configuration' %}

Your Content

- {% include docs_ul.html items='frontmatter posts drafts pages variables datafiles migrations' %} + {% include docs_ul.html items='frontmatter posts drafts pages variables datafiles assets migrations' %}

Customization

{% include docs_ul.html items='templates permalinks pagination plugins extras' %}

Deployment

diff --git a/site/_includes/docs_contents_mobile.html b/site/_includes/docs_contents_mobile.html index bbc367d4..6313a59f 100644 --- a/site/_includes/docs_contents_mobile.html +++ b/site/_includes/docs_contents_mobile.html @@ -5,7 +5,7 @@ {% include docs_option.html items='home quickstart installation usage structure configuration' %} - {% include docs_option.html items='frontmatter posts drafts pages variables datafiles migrations' %} + {% include docs_option.html items='frontmatter posts drafts pages variables datafiles assets migrations' %} {% include docs_option.html items='templates permalinks pagination plugins extras' %} diff --git a/site/docs/assets.md b/site/docs/assets.md new file mode 100644 index 00000000..5191dc15 --- /dev/null +++ b/site/docs/assets.md @@ -0,0 +1,46 @@ +--- +layout: docs +title: Assets +prev_section: datafiles +next_section: migrations +permalink: /docs/assets/ +--- + +Jekyll provides built-in support for Sass and CoffeeScript. In order to use +them, create a file with the proper extension name (one of `.sass`, `.scss`, +or `.coffee`) and start the file with two lines of triple dashes, like this: + +{% highlight sass %} +--- +--- + +// start content +.my-definition + font-size: 1.2em +{% endhighlight %} + +## Sass/SCSS + +Jekyll allows you to customize your Sass conversion in certain ways. + +If you are using Sass `@import` statements, you'll need to ensure that your +`sass_dir` is set to the base directory that contains your Sass files. You +can do that thusly: + +{% highlight yaml %} +sass: + sass_dir: _sass +{% endhighlight %} + +The Sass converter will default to `_sass`. + +You may also specify the output style with the `style` option in your +`_config.yml` file: + +{% highlight yaml %} +sass: + style: :compressed +{% endhighlight %} + +These are passed to Sass, so any output style options Sass supports are valid +here, too. diff --git a/site/docs/datafiles.md b/site/docs/datafiles.md index b3421c38..55af6ec4 100644 --- a/site/docs/datafiles.md +++ b/site/docs/datafiles.md @@ -2,25 +2,25 @@ layout: docs title: Data Files prev_section: variables -next_section: migrations +next_section: assets permalink: /docs/datafiles/ --- In addition to the [built-in variables](../variables/) available from Jekyll, -you can specify your own custom data that can be accessed via the [Liquid +you can specify your own custom data that can be accessed via the [Liquid templating system](http://wiki.github.com/shopify/liquid/liquid-for-designers). -Jekyll supports loading data from [YAML](http://yaml.org/) files located in the +Jekyll supports loading data from [YAML](http://yaml.org/) files located in the `_data` directory. This powerful feature allows you to avoid repetition in your templates and to -set site specific options without changing `_config.yml`. +set site specific options without changing `_config.yml`. Plugins/themes can also leverage Data Files to set configuration variables. ## The Data Folder -As explained on the [directory structure](../structure/) page, the `_data` +As explained on the [directory structure](../structure/) page, the `_data` folder is where you can store additional data for Jekyll to use when generating your site. These files must be YAML files (using either the `.yml` or `.yaml` extension) and they will be accessible via `site.data`. diff --git a/site/docs/migrations.md b/site/docs/migrations.md index 27ecf71d..f9ecc1f5 100644 --- a/site/docs/migrations.md +++ b/site/docs/migrations.md @@ -1,7 +1,7 @@ --- layout: docs title: Blog migrations -prev_section: datafiles +prev_section: assets next_section: templates permalink: /docs/migrations/ --- From 4afe39e4611fb466abd58c36c2fe0da1dcf6fd6c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 21:36:08 -0800 Subject: [PATCH 10/13] Allow caching in unsafe mode, but disable in safe mode. --- lib/jekyll/converters/sass.rb | 6 +++++- test/test_sass.rb | 14 ++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index 424a1fbc..0401ffb3 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -38,10 +38,14 @@ module Jekyll ) end + def allow_caching? + !@config["safe"] + end + def sass_configs(content = "") sass_build_configuration_options({ "syntax" => syntax_type_of_content(content), - "cache" => false, + "cache" => allow_caching?, "load_paths" => [sass_dir_relative_to_site_source] }) end diff --git a/test/test_sass.rb b/test/test_sass.rb index bc49a227..477ef203 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -54,8 +54,14 @@ CSS end context "when building configurations" do - should "not allow caching" do - assert_equal false, converter.sass_configs[:cache] + should "not allow caching in safe mode" do + verter = converter + verter.instance_variable_get(:@config)["safe"] = true + assert_equal false, verter.sass_configs[:cache] + end + + should "allow caching in unsafe mode" do + assert_equal true, converter.sass_configs[:cache] end should "set the load paths to the _sass dir relative to site source" do @@ -85,10 +91,6 @@ CSS should "override user-set syntax based on content" do assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax] end - - should "override user-set cache setting" do - assert_equal false, converter("cache" => true).sass_configs[:cache] - end end context "converting sass" do From 824d9f6ca8ece2029ce6d5eeb7e7030201b6714f Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 15 Jan 2014 22:49:33 -0600 Subject: [PATCH 11/13] Better express that the converter always outputs css --- test/test_sass.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_sass.rb b/test/test_sass.rb index 477ef203..63e172e7 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -49,7 +49,7 @@ CSS context "determining the output file extension" do should "output .css file extension" do - assert_equal ".css", converter.output_ext(".sass") + assert_equal ".css", converter.output_ext(".always-css") end end From 10e5ecfe53ac104bdbc64fbac624697e0e536836 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 15 Jan 2014 22:49:33 -0600 Subject: [PATCH 12/13] Improve the test description for the outputs_ext test --- test/test_sass.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_sass.rb b/test/test_sass.rb index 63e172e7..d13fbcfe 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -48,7 +48,7 @@ CSS end context "determining the output file extension" do - should "output .css file extension" do + should "always outputs the .css file extension" do assert_equal ".css", converter.output_ext(".always-css") end end From c9a3c40f8392638fddb6f4b68875dea0ad89d163 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 24 Jan 2014 12:19:19 -0500 Subject: [PATCH 13/13] fixes based on @mattr-'s notes --- lib/jekyll/converters/sass.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/converters/sass.rb b/lib/jekyll/converters/sass.rb index 0401ffb3..0c36eb65 100644 --- a/lib/jekyll/converters/sass.rb +++ b/lib/jekyll/converters/sass.rb @@ -11,12 +11,12 @@ module Jekyll ".css" end - def user_sass_configs + def jekyll_sass_configuration @config["sass"] || {} end def sass_build_configuration_options(overrides) - user_sass_configs.deep_merge(overrides).symbolize_keys + jekyll_sass_configuration.deep_merge(overrides).symbolize_keys end def syntax_type_of_content(content) @@ -28,13 +28,14 @@ module Jekyll end def sass_dir - user_sass_configs["sass_dir"] || "_sass" + return "_sass" if jekyll_sass_configuration["sass_dir"].to_s.empty? + jekyll_sass_configuration["sass_dir"] end def sass_dir_relative_to_site_source File.join( @config["source"], - File.expand_path(sass_dir, "/") + File.expand_path(sass_dir, "/") # FIXME: Not windows-compatible ) end