Merge pull request #789 from bhollis/haml
Support Haml 4. Tests only run with Haml 4 now.
This commit is contained in:
commit
f0e76c85d0
4
Gemfile
4
Gemfile
|
@ -1,5 +1,8 @@
|
|||
source :rubygems
|
||||
|
||||
# Make sure to use Haml 4 for tests
|
||||
gem "haml", "~> 4.0.0"
|
||||
|
||||
# Build and doc tools
|
||||
gem "rake", "~> 10.0.3"
|
||||
gem "yard", "~> 0.8.0"
|
||||
|
@ -13,7 +16,6 @@ gem "rspec", "~> 2.12"
|
|||
# Optional middleman dependencies, included for tests
|
||||
gem "sinatra"
|
||||
gem "slim", "~> 1.2.0"
|
||||
gem "coffee-filter", "~> 0.1.1"
|
||||
gem "liquid", "~> 2.2"
|
||||
gem "less", "~> 2.2"
|
||||
gem "stylus", "~> 0.6.2"
|
||||
|
|
|
@ -11,25 +11,29 @@ module Middleman
|
|||
class << self
|
||||
# Once registered
|
||||
def registered(app)
|
||||
app.before_configuration do
|
||||
template_extensions :coffee => :js
|
||||
end
|
||||
|
||||
# Tell Tilt to use it as well (for inline scss blocks)
|
||||
::Tilt.register 'coffee', DebuggingCoffeeScriptTemplate
|
||||
::Tilt.prefer(DebuggingCoffeeScriptTemplate)
|
||||
|
||||
app.before_configuration do
|
||||
template_extensions :coffee => :js
|
||||
DebuggingCoffeeScriptTemplate.middleman_app = self
|
||||
end
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
||||
# A Template for Tilt which outputs debug messages
|
||||
class DebuggingCoffeeScriptTemplate < ::Tilt::CoffeeScriptTemplate
|
||||
# Make the current Middleman app accessible to the template
|
||||
cattr_accessor :middleman_app
|
||||
|
||||
# Add exception messaging
|
||||
# @param [Class] context
|
||||
# @param [Hash] locals
|
||||
# @return [String]
|
||||
def evaluate(context, locals, &block)
|
||||
return super if context.build?
|
||||
return super if middleman_app.build?
|
||||
|
||||
begin
|
||||
super
|
||||
|
|
|
@ -53,13 +53,11 @@ Feature: Minify CSS
|
|||
When I go to "/inline-css.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<style type='text/css'>
|
||||
/*<![CDATA[*/
|
||||
body {
|
||||
test: style;
|
||||
good: deal;
|
||||
}
|
||||
/*]]>*/
|
||||
<style>
|
||||
body {
|
||||
test: style;
|
||||
good: deal;
|
||||
}
|
||||
</style>
|
||||
"""
|
||||
|
||||
|
@ -83,7 +81,7 @@ Feature: Minify CSS
|
|||
When I go to "/inline-css.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<style type='text/css'>
|
||||
<style>
|
||||
body {
|
||||
test: style;
|
||||
good: deal; }
|
||||
|
@ -108,7 +106,7 @@ Feature: Minify CSS
|
|||
When I go to "/inline-css.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<style type='text/css'>
|
||||
<style>
|
||||
Hello
|
||||
</style>
|
||||
"""
|
||||
|
@ -123,9 +121,7 @@ Feature: Minify CSS
|
|||
When I go to "/inline-css.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<style type='text/css'>
|
||||
/*<![CDATA[*/
|
||||
body{test:style;good:deal}
|
||||
/*]]>*/
|
||||
<style>
|
||||
body{test:style;good:deal}
|
||||
</style>
|
||||
"""
|
|
@ -10,15 +10,13 @@ Feature: Minify Javascript
|
|||
When I go to "/inline-js.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
;(function() {
|
||||
this;
|
||||
should();
|
||||
all.be();
|
||||
on = { one: line };
|
||||
})();
|
||||
//]]>
|
||||
<script>
|
||||
;(function() {
|
||||
this;
|
||||
should();
|
||||
all.be();
|
||||
on = { one: line };
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
;(function() {
|
||||
|
@ -61,15 +59,13 @@ Feature: Minify Javascript
|
|||
When I go to "/inline-js.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
;(function() {
|
||||
this;
|
||||
should();
|
||||
all.be();
|
||||
on = { one: line };
|
||||
})();
|
||||
//]]>
|
||||
<script>
|
||||
;(function() {
|
||||
this;
|
||||
should();
|
||||
all.be();
|
||||
on = { one: line };
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
;(function() {
|
||||
|
@ -110,10 +106,8 @@ Feature: Minify Javascript
|
|||
When I go to "/inline-js.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
Hello
|
||||
//]]>
|
||||
<script>
|
||||
Hello
|
||||
</script>
|
||||
<script>
|
||||
Hello
|
||||
|
@ -138,10 +132,8 @@ Feature: Minify Javascript
|
|||
When I go to "/inline-js.html"
|
||||
Then I should see:
|
||||
"""
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
(function(){this,should(),all.be(),on={one:line}})();
|
||||
//]]>
|
||||
<script>
|
||||
(function(){this,should(),all.be(),on={one:line}})();
|
||||
</script>
|
||||
<script>
|
||||
(function(){this,should(),too()})();
|
||||
|
@ -177,12 +169,11 @@ Feature: Minify Javascript
|
|||
Given a fixture app "minify-js-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
require "coffee-filter"
|
||||
activate :minify_javascript, :inline => true
|
||||
"""
|
||||
And the Server is running at "minify-js-app"
|
||||
When I go to "/inline-coffeescript.html"
|
||||
Then I should see "6" lines
|
||||
Then I should see "3" lines
|
||||
|
||||
Scenario: Rendering external js (coffeescript) with the feature enabled
|
||||
Given a fixture app "minify-js-app"
|
||||
|
@ -198,8 +189,6 @@ Feature: Minify Javascript
|
|||
Given a fixture app "passthrough-app"
|
||||
And a file named "config.rb" with:
|
||||
"""
|
||||
require "coffee-filter"
|
||||
|
||||
module ::PassThrough
|
||||
def self.compress(data)
|
||||
data
|
||||
|
@ -214,7 +203,7 @@ Feature: Minify Javascript
|
|||
"""
|
||||
And the Server is running at "passthrough-app"
|
||||
When I go to "/inline-coffeescript.html"
|
||||
Then I should see "16" lines
|
||||
Then I should see "13" lines
|
||||
|
||||
Scenario: Rendering external js (coffeescript) with a passthrough minifier
|
||||
Given a fixture app "passthrough-app"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
require "coffee-filter"
|
|
@ -1 +0,0 @@
|
|||
require "coffee-filter"
|
|
@ -1,5 +1,4 @@
|
|||
%style(type="text/css")
|
||||
:sass
|
||||
body
|
||||
test: style
|
||||
good: deal
|
||||
:sass
|
||||
body
|
||||
test: style
|
||||
good: deal
|
Loading…
Reference in a new issue