From 4afe39e4611fb466abd58c36c2fe0da1dcf6fd6c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 12 Jan 2014 21:36:08 -0800 Subject: [PATCH] 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