fix css minify
This commit is contained in:
parent
73be9b5a34
commit
9880f0f6dc
0
lib/middleman.rb
Executable file → Normal file
0
lib/middleman.rb
Executable file → Normal file
|
@ -1,5 +1,9 @@
|
||||||
# Otherwise use YUI
|
class Middleman::Base
|
||||||
# Fine a way to minify inline/css
|
after_feature_init do
|
||||||
::Compass.configuration do |config|
|
::Compass.configuration do |config|
|
||||||
config.output_style = :compressed
|
config.output_style = :compressed
|
||||||
|
end
|
||||||
|
|
||||||
|
::Compass.configure_sass_plugin!
|
||||||
|
end
|
||||||
end
|
end
|
6
spec/fixtures/sample/init.rb
vendored
6
spec/fixtures/sample/init.rb
vendored
|
@ -1,9 +1,13 @@
|
||||||
# enable :maruku
|
# enable :maruku
|
||||||
|
|
||||||
|
get "/inline-css.html" do
|
||||||
|
haml :"inline-css.html", :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
get "/inline-js.html" do
|
get "/inline-js.html" do
|
||||||
haml :"inline-js.html", :layout => false
|
haml :"inline-js.html", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
get "/page-class.html" do
|
get "/page-class.html" do
|
||||||
haml :"page-classes.html", :layout => false
|
haml :"page-classes.html", :layout => false
|
||||||
end
|
end
|
||||||
|
|
4
spec/fixtures/sample/views/inline-css.html.haml
vendored
Executable file
4
spec/fixtures/sample/views/inline-css.html.haml
vendored
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
:sass
|
||||||
|
body
|
||||||
|
test: style
|
||||||
|
good: deal
|
20
spec/minify_css_spec.rb
Executable file
20
spec/minify_css_spec.rb
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
require File.join(File.dirname(__FILE__), "spec_helper")
|
||||||
|
|
||||||
|
base = ::Middleman::Base
|
||||||
|
base.set :root, File.join(File.dirname(__FILE__), "fixtures", "sample")
|
||||||
|
|
||||||
|
describe "Minify Javascript Feature" do
|
||||||
|
it "should not minify inline css if off" do
|
||||||
|
base.disable :minify_css
|
||||||
|
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
||||||
|
browser.get("/inline-css.html")
|
||||||
|
browser.last_response.body.chomp.split($/).length.should == 3
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should minify inline css if on" do
|
||||||
|
base.enable :minify_css
|
||||||
|
browser = Rack::Test::Session.new(Rack::MockSession.new(base.new))
|
||||||
|
browser.get("/inline-css.html")
|
||||||
|
browser.last_response.body.chomp.split($/).length.should == 1
|
||||||
|
end
|
||||||
|
end
|
0
vendor/gems/environment.rb
vendored
Executable file → Normal file
0
vendor/gems/environment.rb
vendored
Executable file → Normal file
Loading…
Reference in a new issue