diff --git a/.ci.gemfile b/.ci.gemfile
index 3724c297..e7f06cca 100644
--- a/.ci.gemfile
+++ b/.ci.gemfile
@@ -25,12 +25,6 @@ else
gem 'json'
end
-if RUBY_VERSION < '2.2.0'
- gem 'sass', '< 3.5'
-else
- gem 'sassc'
-end
-
case RUBY_VERSION[0, 3]
when '1.9', '2.0'
gem 'rack', '<1.6'
diff --git a/roda.gemspec b/roda.gemspec
index ac5b5e75..41adf726 100644
--- a/roda.gemspec
+++ b/roda.gemspec
@@ -28,7 +28,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "tilt"
s.add_development_dependency "erubi"
s.add_development_dependency "rack_csrf"
- s.add_development_dependency "sassc"
s.add_development_dependency "json"
s.add_development_dependency "mail"
end
diff --git a/spec/assets/css/app.scss b/spec/assets/css/app.html
similarity index 100%
rename from spec/assets/css/app.scss
rename to spec/assets/css/app.html
diff --git a/spec/assets/css/app.str b/spec/assets/css/app.str
new file mode 100644
index 00000000..991912d8
--- /dev/null
+++ b/spec/assets/css/app.str
@@ -0,0 +1 @@
+body { color: red; }
diff --git a/spec/assets/css/import.scss b/spec/assets/css/import.scss
deleted file mode 100644
index dffd5a8f..00000000
--- a/spec/assets/css/import.scss
+++ /dev/null
@@ -1 +0,0 @@
-@import 'importdep';
diff --git a/spec/assets/css/import.str b/spec/assets/css/import.str
new file mode 100644
index 00000000..ad455e26
--- /dev/null
+++ b/spec/assets/css/import.str
@@ -0,0 +1 @@
+#{File.binread(File.join(File.dirname(__FILE__), 'importdep.str'))}
diff --git a/spec/plugin/assets_preloading_spec.rb b/spec/plugin/assets_preloading_spec.rb
index 6d3eba20..e0744843 100644
--- a/spec/plugin/assets_preloading_spec.rb
+++ b/spec/plugin/assets_preloading_spec.rb
@@ -3,16 +3,10 @@
run_tests = true
begin
begin
- require 'tilt/sass'
+ require 'tilt'
rescue LoadError
- begin
- for lib in %w'tilt sass'
- require lib
- end
- rescue LoadError
- warn "#{lib} not installed, skipping assets_preloading plugin test"
- run_tests = false
- end
+ warn "tilt not installed, skipping assets_preloading plugin test"
+ run_tests = false
end
end
@@ -20,7 +14,7 @@
before do
app(:bare) do
plugin :assets, {
- :css => ['app.scss'],
+ :css => ['app.str'],
:js => { :head => ['app.js'] },
:path => 'spec/assets',
:public => 'spec',
diff --git a/spec/plugin/assets_spec.rb b/spec/plugin/assets_spec.rb
index 0d35eefc..423e26b6 100644
--- a/spec/plugin/assets_spec.rb
+++ b/spec/plugin/assets_spec.rb
@@ -4,16 +4,10 @@
run_tests = true
begin
begin
- require 'tilt/sass'
+ require 'tilt'
rescue LoadError
- begin
- for lib in %w'tilt sass'
- require lib
- end
- rescue LoadError
- warn "#{lib} not installed, skipping assets plugin test"
- run_tests = false
- end
+ warn "tilt not installed, skipping assets plugin test"
+ run_tests = false
end
end
@@ -21,7 +15,7 @@
pid_dir = "spec/pid-#{$$}"
assets_dir = File.join(pid_dir, "assets")
metadata_file = File.expand_path(File.join(assets_dir, 'precompiled.json'))
- importdep_file = File.expand_path(File.join(assets_dir, 'css/importdep.scss'))
+ importdep_file = File.expand_path(File.join(assets_dir, 'css/importdep.str'))
js_file = File.expand_path(File.join(assets_dir, 'js/head/app.js'))
css_file = File.expand_path(File.join(assets_dir, 'css/no_access.css'))
describe 'assets plugin' do
@@ -36,7 +30,7 @@
before do
app(:bare) do
plugin :assets,
- :css => ['app.scss', 'raw.css'],
+ :css => ['app.str', 'raw.css'],
:js => { :head => ['app.js'] },
:path => assets_dir,
:public => pid_dir,
@@ -162,7 +156,7 @@ def gunzip(body)
it 'assets_paths should return arrays of source paths' do
html = body('/paths_test')
- html.scan('css:Array:2:/assets/css/app.scss,/assets/css/raw.css').length.must_equal 1
+ html.scan('css:Array:2:/assets/css/app.str,/assets/css/raw.css').length.must_equal 1
html.scan('js:Array:1:/assets/js/head/app.js').length.must_equal 1
html.scan('empty:Array:0').length.must_equal 1
end
@@ -181,22 +175,22 @@ def gunzip(body)
app.plugin :assets, :relative_paths=>true
html = body('/paths_test')
- html.scan('css:Array:2:./assets/css/app.scss,./assets/css/raw.css').length.must_equal 1
+ html.scan('css:Array:2:./assets/css/app.str,./assets/css/raw.css').length.must_equal 1
html.scan('js:Array:1:./assets/js/head/app.js').length.must_equal 1
html.scan('empty:Array:0').length.must_equal 1
html = body('/paths_test/foo')
- html.scan('css:Array:2:../assets/css/app.scss,../assets/css/raw.css').length.must_equal 1
+ html.scan('css:Array:2:../assets/css/app.str,../assets/css/raw.css').length.must_equal 1
html.scan('js:Array:1:../assets/js/head/app.js').length.must_equal 1
html.scan('empty:Array:0').length.must_equal 1
html = body('/paths_test/foo/')
- html.scan('css:Array:2:../../assets/css/app.scss,../../assets/css/raw.css').length.must_equal 1
+ html.scan('css:Array:2:../../assets/css/app.str,../../assets/css/raw.css').length.must_equal 1
html.scan('js:Array:1:../../assets/js/head/app.js').length.must_equal 1
html.scan('empty:Array:0').length.must_equal 1
html = body('/paths_test/foo/bar')
- html.scan('css:Array:2:../../assets/css/app.scss,../../assets/css/raw.css').length.must_equal 1
+ html.scan('css:Array:2:../../assets/css/app.str,../../assets/css/raw.css').length.must_equal 1
html.scan('js:Array:1:../../assets/js/head/app.js').length.must_equal 1
html.scan('empty:Array:0').length.must_equal 1
end
@@ -226,7 +220,7 @@ def gunzip(body)
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling' do
html = body('/test')
html.scan(/true
html = body('/test')
html.scan(/'-'
html = body('/test')
html.scan(/'POST').must_equal 404
html =~ %r{href="(/assets/css/raw\.css)"}
status($1, 'REQUEST_METHOD'=>'POST').must_equal 404
@@ -287,7 +281,7 @@ def gunzip(body)
app.plugin :assets, :early_hints=>true
eh = []
html = body('/test', 'rack.early_hints'=>proc{|h| eh << h})
- css_eh = ["; rel=preload; as=style", "; rel=preload; as=style"]
+ css_eh = ["; rel=preload; as=style", "; rel=preload; as=style"]
js_eh = ["; rel=preload; as=script"]
if Rack.release < '3'
css_eh = css_eh.join("\n")
@@ -298,7 +292,7 @@ def gunzip(body)
{Roda::RodaResponseHeaders::LINK=>js_eh}
]
html.scan(/'/foo')
html.scan(/'foo', :css_route=>'bar', :add_suffix=>true, :css_opts=>{:style=>:compressed}
html = body('/test')
html.scan(/pid_dir, :js_dir=>nil, :css_dir=>nil, :prefix=>nil,
- :css=>{:assets=>{:css=>%w'app.scss raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
+ :css=>{:assets=>{:css=>%w'app.str raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
app.route do |r|
r.assets
r.is 'test' do
@@ -355,7 +349,7 @@ def gunzip(body)
end
html = body('/test')
html.scan(/ false' do
app.plugin :assets, :path=>pid_dir, :js_dir=>nil, :css_dir=>nil, :prefix=>nil, :group_subdirs=>false,
- :css=>{:assets=>{:css=>%w'assets/css/app.scss assets/css/raw.css'}}, :js=>{:assets=>{:js=>{:head=>'assets/js/head/app.js'}}}
+ :css=>{:assets=>{:css=>%w'assets/css/app.str assets/css/raw.css'}}, :js=>{:assets=>{:js=>{:head=>'assets/js/head/app.js'}}}
app.route do |r|
r.assets
r.is 'test' do
@@ -378,7 +372,7 @@ def gunzip(body)
end
html = body('/test')
html.scan(/pid_dir, :js_dir=>nil, :css_dir=>nil, :compiled_js_dir=>nil, :compiled_css_dir=>nil,
- :css=>{:assets=>{:css=>%w'app.scss raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
+ :css=>{:assets=>{:css=>%w'app.str raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
app.compile_assets
app.route do |r|
r.assets
@@ -629,7 +623,7 @@ def gunzip(body)
it 'should handle rendering assets, linking to them, and accepting requests for them when not compiling with a multi-level hash when :add_script_name app option is used' do
app.opts[:add_script_name] = true
app.plugin :assets, :path=>pid_dir, :js_dir=>nil, :css_dir=>nil, :compiled_js_dir=>nil, :compiled_css_dir=>nil,
- :css=>{:assets=>{:css=>%w'app.scss raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
+ :css=>{:assets=>{:css=>%w'app.str raw.css'}}, :js=>{:assets=>{:js=>{:head=>'app.js'}}}
app.compile_assets
app.route do |r|
r.assets
@@ -651,7 +645,7 @@ def gunzip(body)
it 'should handle :group_subdirs => false when compiling' do
app.plugin :assets, :path=>pid_dir, :js_dir=>nil, :css_dir=>nil, :compiled_js_dir=>nil, :compiled_css_dir=>nil, :group_subdirs=>false,
- :css=>{:assets=>{:css=>%w'assets/css/app.scss assets/css/raw.css'}}, :js=>{:assets=>{:js=>{:head=>'assets/js/head/app.js'}}}
+ :css=>{:assets=>{:css=>%w'assets/css/app.str assets/css/raw.css'}}, :js=>{:assets=>{:js=>{:head=>'assets/js/head/app.js'}}}
app.compile_assets
app.route do |r|
r.assets
@@ -784,22 +778,22 @@ def gunzip(body)
end
it 'requests for assets should include modifications to content of dependencies' do
- File.open(File.join(assets_dir, 'css/importdep.scss'), 'wb'){|f| f.write('body{color:blue}')}
- app.plugin :assets, :css=>['import.scss'],
- :dependencies=>{File.join(assets_dir, 'css/import.scss')=>File.join(assets_dir, 'css/importdep.scss')}
+ File.open(File.join(assets_dir, 'css/importdep.str'), 'wb'){|f| f.write('body{color: blue;}')}
+ app.plugin :assets, :css=>['import.str'],
+ :dependencies=>{File.join(assets_dir, 'css/import.str')=>File.join(assets_dir, 'css/importdep.str')}
app.plugin :render, :cache=>false
3.times do
- body('/assets/css/import.scss').must_include('color: blue;')
+ body('/assets/css/import.str').must_include('color: blue;')
end
- File.open(File.join(assets_dir, 'css/importdep.scss'), 'wb'){|f| f.write('body{color:red}')}
- File.utime(Time.now+2, Time.now+4, File.join(assets_dir, 'css/importdep.scss'))
+ File.open(File.join(assets_dir, 'css/importdep.str'), 'wb'){|f| f.write('body{color: red;}')}
+ File.utime(Time.now+2, Time.now+4, File.join(assets_dir, 'css/importdep.str'))
3.times do
- body('/assets/css/import.scss').must_include('color: red;')
+ body('/assets/css/import.str').must_include('color: red;')
end
end
it 'should do a terminal match for assets' do
- status('/assets/css/app.scss/foo').must_equal 404
+ status('/assets/css/app.str/foo').must_equal 404
end
it 'should only allow files that you specify' do
@@ -828,7 +822,7 @@ def gunzip(body)
app.plugin :assets, :path=>pid_dir, :js_dir=>nil, :css_dir=>nil, :prefix=>nil,
:postprocessor=>postprocessor,
- :css=>{:assets=>{:css=>%w'app.scss'}}
+ :css=>{:assets=>{:css=>%w'app.str'}}
app.route do |r|
r.assets
r.is 'test' do
@@ -837,9 +831,9 @@ def gunzip(body)
end
html = body('/test')
html.scan(/'spec/views'
plugin :precompile_templates
route do |r|
- render(:path=>File.expand_path('spec/assets/css/app.scss'), :template_opts=>{:cache=>false})
+ render(:path=>File.expand_path('spec/assets/css/app.html'), :template_opts=>{:cache=>false})
end
end
- key = [File.expand_path("spec/assets/css/app.scss"), nil, nil, {:cache=>false}, nil]
+ key = [File.expand_path("spec/assets/css/app.html"), nil, nil, {:cache=>false}, nil]
app.render_opts[:cache][key].must_be_nil
- app.precompile_templates(:path=>File.expand_path('spec/assets/css/app.scss'), :template_opts=>{:cache=>false})
+ app.precompile_templates(:path=>File.expand_path('spec/assets/css/app.html'), :template_opts=>{:cache=>false})
app.render_opts[:cache][key].wont_be_nil
app.freeze_template_caches!
body.must_match(/color: red;/)
diff --git a/spec/plugin/recheck_precompiled_assets_spec.rb b/spec/plugin/recheck_precompiled_assets_spec.rb
index 22c7c8f9..e1a72ef4 100644
--- a/spec/plugin/recheck_precompiled_assets_spec.rb
+++ b/spec/plugin/recheck_precompiled_assets_spec.rb
@@ -4,16 +4,10 @@
run_tests = true
begin
begin
- require 'tilt/sass'
+ require 'tilt'
rescue LoadError
- begin
- for lib in %w'tilt sass'
- require lib
- end
- rescue LoadError
- warn "#{lib} not installed, skipping assets plugin test"
- run_tests = false
- end
+ warn "tilt not installed, skipping assets plugin test"
+ run_tests = false
end
end
@@ -24,7 +18,7 @@
describe 'recheck_precompiled_assets plugin' do
define_method(:compile_assets) do |opts={}|
Class.new(Roda) do
- plugin :assets, {:css => 'app.scss', :path => assets_dir, :css_dir=>nil, :precompiled=>metadata_file, :public=>assets_dir, :prefix=>nil}.merge!(opts)
+ plugin :assets, {:css => 'app.str', :path => assets_dir, :css_dir=>nil, :precompiled=>metadata_file, :public=>assets_dir, :prefix=>nil}.merge!(opts)
compile_assets
end
end
@@ -32,7 +26,7 @@
before do
Dir.mkdir(pid_dir) unless File.directory?(pid_dir)
Dir.mkdir(assets_dir) unless File.directory?(assets_dir)
- FileUtils.cp('spec/assets/css/app.scss', assets_dir)
+ FileUtils.cp('spec/assets/css/app.str', assets_dir)
FileUtils.cp('spec/assets/js/head/app.js', assets_dir)
compile_assets
File.utime(Time.now, Time.now - 20, metadata_file)
@@ -57,8 +51,8 @@
body.scan("href=\"/app.#{css_hash}.css\"").length.must_equal 1
body("/app.#{css_hash}.css").must_match(/color:\s*red/)
- scss_file = File.join(assets_dir, 'app.scss')
- File.write(scss_file, File.read(scss_file).sub('red', 'blue'))
+ css_file = File.join(assets_dir, 'app.str')
+ File.write(css_file, File.read(css_file).sub('red', 'blue'))
compile_assets
File.utime(Time.now, Time.now - 10, metadata_file)
@@ -85,7 +79,7 @@
app.assets_opts[:compiled].replace({})
app.compile_assets
body.strip.must_be_empty
- app.plugin :assets, :css => 'app.scss', :path => assets_dir, :css_dir=>nil, :css_opts => {:cache=>false}
+ app.plugin :assets, :css => 'app.str', :path => assets_dir, :css_dir=>nil, :css_opts => {:cache=>false}
app.compile_assets
body.scan("href=\"/app.#{css2_hash}.css\"").length.must_equal 1
body("/app.#{css2_hash}.css").must_match(/color:\s*blue/)