Allow caching in unsafe mode, but disable in safe mode.
This commit is contained in:
parent
6b92126fd8
commit
4afe39e461
|
@ -38,10 +38,14 @@ module Jekyll
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def allow_caching?
|
||||||
|
!@config["safe"]
|
||||||
|
end
|
||||||
|
|
||||||
def sass_configs(content = "")
|
def sass_configs(content = "")
|
||||||
sass_build_configuration_options({
|
sass_build_configuration_options({
|
||||||
"syntax" => syntax_type_of_content(content),
|
"syntax" => syntax_type_of_content(content),
|
||||||
"cache" => false,
|
"cache" => allow_caching?,
|
||||||
"load_paths" => [sass_dir_relative_to_site_source]
|
"load_paths" => [sass_dir_relative_to_site_source]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,8 +54,14 @@ CSS
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when building configurations" do
|
context "when building configurations" do
|
||||||
should "not allow caching" do
|
should "not allow caching in safe mode" do
|
||||||
assert_equal false, converter.sass_configs[:cache]
|
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
|
end
|
||||||
|
|
||||||
should "set the load paths to the _sass dir relative to site source" do
|
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
|
should "override user-set syntax based on content" do
|
||||||
assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax]
|
assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax]
|
||||||
end
|
end
|
||||||
|
|
||||||
should "override user-set cache setting" do
|
|
||||||
assert_equal false, converter("cache" => true).sass_configs[:cache]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "converting sass" do
|
context "converting sass" do
|
||||||
|
|
Loading…
Reference in New Issue