middleman-more 3.0.0.beta.1 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/features/asset_hash.feature +84 -0
- data/features/cache_buster.feature +5 -4
- data/features/coffee-script.feature +2 -2
- data/features/compass-sprites.feature +6 -0
- data/features/gzip.feature +21 -0
- data/features/{ignore_already_minified.features → ignore_already_minified.feature} +0 -0
- data/features/minify_css.feature +50 -2
- data/features/minify_javascript.feature +89 -6
- data/features/relative_assets.feature +47 -6
- data/features/sass_partials.feature +5 -1
- data/features/sprockets_gems.feature +7 -2
- data/fixtures/asset-hash-app/config.rb +8 -0
- data/fixtures/asset-hash-app/source/images/100px.gif +0 -0
- data/fixtures/asset-hash-app/source/images/100px.jpg +0 -0
- data/fixtures/asset-hash-app/source/images/100px.png +0 -0
- data/fixtures/asset-hash-app/source/index.html.erb +308 -0
- data/fixtures/asset-hash-app/source/javascripts/application.js +8 -0
- data/fixtures/asset-hash-app/source/layout.erb +18 -0
- data/fixtures/asset-hash-app/source/other.html.erb +2 -0
- data/fixtures/asset-hash-app/source/partials.html.erb +1 -0
- data/fixtures/asset-hash-app/source/stylesheets/_partial.sass +2 -0
- data/fixtures/asset-hash-app/source/stylesheets/site.css.scss +4 -0
- data/fixtures/asset-hash-app/source/stylesheets/uses_partials.css.sass +4 -0
- data/fixtures/asset-hash-app/source/subdir/index.html.erb +308 -0
- data/fixtures/asset-hash-host-app/config.rb +6 -0
- data/fixtures/asset-hash-host-app/source/images/100px.gif +0 -0
- data/fixtures/asset-hash-host-app/source/images/100px.jpg +0 -0
- data/fixtures/asset-hash-host-app/source/images/100px.png +0 -0
- data/fixtures/asset-hash-host-app/source/index.html.erb +6 -0
- data/fixtures/asset-hash-host-app/source/layout.erb +17 -0
- data/fixtures/asset-hash-host-app/source/other.html.erb +2 -0
- data/fixtures/asset-hash-host-app/source/stylesheets/site.css.scss +4 -0
- data/fixtures/asset-hash-host-app/source/subdir/index.html.erb +6 -0
- data/fixtures/cache-buster-app/source/cache-buster.html.erb +2 -1
- data/fixtures/compass-sprites-app/config.rb +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_down.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_left.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_right.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_up.png +0 -0
- data/fixtures/compass-sprites-app/source/stylesheets/site.css.scss +3 -0
- data/fixtures/gzip-app/config.rb +1 -0
- data/fixtures/gzip-app/source/index.html +0 -0
- data/fixtures/gzip-app/source/javascripts/test.js +1 -0
- data/fixtures/gzip-app/source/stylesheets/test.css +1 -0
- data/fixtures/minify-css-app/source/inline-css.html.haml +5 -0
- data/fixtures/minify-css-app/source/more-css/site.css +3 -0
- data/fixtures/minify-css-app/source/stylesheets/site.css.sass +5 -1
- data/fixtures/minify-js-app/config.rb +1 -1
- data/fixtures/minify-js-app/source/inline-js.html.haml +22 -1
- data/fixtures/minify-js-app/source/more-js/other.js +8 -0
- data/fixtures/passthrough-app/config.rb +4 -4
- data/fixtures/passthrough-app/source/inline-css.html.haml +5 -4
- data/fixtures/passthrough-app/source/inline-js.html.haml +22 -1
- data/fixtures/relative-assets-app/config.rb +1 -0
- data/fixtures/relative-assets-app/source/relative_image.html.erb +8 -1
- data/fixtures/sprockets-app/source/library/js/vendored_include.js +1 -0
- data/fixtures/sprockets-app/vendor/assets/javascripts/vendored_js.js +1 -0
- data/lib/middleman-more.rb +23 -9
- data/lib/middleman-more/core_extensions/compass.rb +22 -38
- data/lib/middleman-more/core_extensions/sprockets.rb +41 -123
- data/lib/middleman-more/extensions/asset_hash.rb +132 -0
- data/lib/middleman-more/extensions/cache_buster.rb +5 -6
- data/lib/middleman-more/extensions/gzip.rb +57 -0
- data/lib/middleman-more/extensions/minify_css.rb +73 -7
- data/lib/middleman-more/extensions/minify_css/rainpress.rb +168 -0
- data/lib/middleman-more/extensions/minify_javascript.rb +45 -21
- data/lib/middleman-more/extensions/relative_assets.rb +2 -1
- data/lib/middleman-more/renderers/haml.rb +4 -0
- data/lib/middleman-more/renderers/liquid.rb +6 -1
- data/lib/middleman-more/renderers/markdown.rb +10 -1
- data/lib/middleman-more/renderers/sass.rb +12 -6
- data/lib/middleman-more/renderers/slim.rb +5 -0
- data/middleman-more.gemspec +9 -9
- metadata +192 -178
- data/lib/middleman-more/extensions/minify_css/cssmin.rb +0 -55
data/Rakefile
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
Feature: Assets get a file hash appended to their and references to them are updated
|
2
|
+
Scenario: Hashed-asset files are produced, and HTML, CSS, and JavaScript gets rewritten to reference the new files
|
3
|
+
Given a successfully built app at "asset-hash-app"
|
4
|
+
When I cd to "build"
|
5
|
+
Then the following files should exist:
|
6
|
+
| index.html |
|
7
|
+
| images/100px-1242c368.png |
|
8
|
+
| images/100px-5fd6fb90.jpg |
|
9
|
+
| images/100px-5fd6fb90.gif |
|
10
|
+
| javascripts/application-570e5d45.js |
|
11
|
+
| stylesheets/site-d9d84711.css |
|
12
|
+
| index.html |
|
13
|
+
| subdir/index.html |
|
14
|
+
| other/index.html |
|
15
|
+
And the following files should not exist:
|
16
|
+
| images/100px.png |
|
17
|
+
| images/100px.jpg |
|
18
|
+
| images/100px.gif |
|
19
|
+
| javascripts/application.js |
|
20
|
+
| stylesheets/site.css |
|
21
|
+
|
22
|
+
And the file "javascripts/application-570e5d45.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'"
|
23
|
+
And the file "stylesheets/site-d9d84711.css" should contain "background-image: url('../images/100px-5fd6fb90.jpg')"
|
24
|
+
And the file "index.html" should contain 'href="stylesheets/site-d9d84711.css"'
|
25
|
+
And the file "index.html" should contain 'src="javascripts/application-570e5d45.js"'
|
26
|
+
And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"'
|
27
|
+
And the file "subdir/index.html" should contain 'href="../stylesheets/site-d9d84711.css"'
|
28
|
+
And the file "subdir/index.html" should contain 'src="../javascripts/application-570e5d45.js"'
|
29
|
+
And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
|
30
|
+
And the file "other/index.html" should contain 'href="../stylesheets/site-d9d84711.css"'
|
31
|
+
And the file "other/index.html" should contain 'src="../javascripts/application-570e5d45.js"'
|
32
|
+
And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
|
33
|
+
|
34
|
+
Scenario: Hashed assets work in preview server
|
35
|
+
Given the Server is running at "asset-hash-app"
|
36
|
+
When I go to "/"
|
37
|
+
Then I should see 'href="stylesheets/site-d9d84711.css"'
|
38
|
+
And I should see 'src="javascripts/application-570e5d45.js"'
|
39
|
+
And I should see 'src="images/100px-5fd6fb90.jpg"'
|
40
|
+
When I go to "/subdir/"
|
41
|
+
Then I should see 'href="../stylesheets/site-d9d84711.css"'
|
42
|
+
And I should see 'src="../javascripts/application-570e5d45.js"'
|
43
|
+
And I should see 'src="../images/100px-5fd6fb90.jpg"'
|
44
|
+
When I go to "/other/"
|
45
|
+
Then I should see 'href="../stylesheets/site-d9d84711.css"'
|
46
|
+
And I should see 'src="../javascripts/application-570e5d45.js"'
|
47
|
+
And I should see 'src="../images/100px-5fd6fb90.jpg"'
|
48
|
+
When I go to "/javascripts/application-570e5d45.js"
|
49
|
+
Then I should see "img.src = '/images/100px-5fd6fb90.jpg'"
|
50
|
+
When I go to "/stylesheets/site-d9d84711.css"
|
51
|
+
Then I should see "background-image: url('../images/100px-5fd6fb90.jpg')"
|
52
|
+
|
53
|
+
Scenario: Enabling an asset host still produces hashed files and references
|
54
|
+
Given the Server is running at "asset-hash-host-app"
|
55
|
+
When I go to "/"
|
56
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-0ac82771.css"'
|
57
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
58
|
+
When I go to "/subdir/"
|
59
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-0ac82771.css"'
|
60
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
61
|
+
When I go to "/other/"
|
62
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-0ac82771.css"'
|
63
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
64
|
+
# Asset helpers don't appear to work from Compass right now
|
65
|
+
# When I go to "/stylesheets/site-0ac82771.css"
|
66
|
+
# Then I should see "background-image: url('http://middlemanapp.com/images/100px-5fd6fb90.jpg')"
|
67
|
+
|
68
|
+
Scenario: The asset hash should change when a SASS or Sprockets partial changes
|
69
|
+
Given the Server is running at "asset-hash-app"
|
70
|
+
And the file "source/stylesheets/_partial.sass" has the contents
|
71
|
+
"""
|
72
|
+
body
|
73
|
+
font-size: 14px
|
74
|
+
"""
|
75
|
+
When I go to "/partials/"
|
76
|
+
Then I should see 'href="../stylesheets/uses_partials-e81dd9b4.css'
|
77
|
+
And the file "source/stylesheets/_partial.sass" has the contents
|
78
|
+
"""
|
79
|
+
body
|
80
|
+
font-size: 18px !important
|
81
|
+
"""
|
82
|
+
When I go to "/partials/"
|
83
|
+
Then I should see 'href="../stylesheets/uses_partials-ba3ef309.css'
|
84
|
+
|
@@ -5,22 +5,23 @@ Feature: Generate mtime-based query string for busting browser caches
|
|
5
5
|
Given "cache_buster" feature is "disabled"
|
6
6
|
And the Server is running at "cache-buster-app"
|
7
7
|
When I go to "/stylesheets/relative_assets.css"
|
8
|
-
Then I should
|
8
|
+
Then I should see "blank.gif'"
|
9
9
|
|
10
10
|
Scenario: Rendering html with the feature disabled
|
11
11
|
Given "cache_buster" feature is "disabled"
|
12
12
|
And the Server is running at "cache-buster-app"
|
13
13
|
When I go to "/cache-buster.html"
|
14
|
-
Then I should
|
14
|
+
Then I should see 'site.css"'
|
15
15
|
|
16
16
|
Scenario: Rendering css with the feature enabled
|
17
17
|
Given "cache_buster" feature is "enabled"
|
18
18
|
And the Server is running at "cache-buster-app"
|
19
19
|
When I go to "/stylesheets/relative_assets.css"
|
20
|
-
Then I should see "?"
|
20
|
+
Then I should see "blank.gif?"
|
21
21
|
|
22
22
|
Scenario: Rendering html with the feature enabled
|
23
23
|
Given "cache_buster" feature is "enabled"
|
24
24
|
And the Server is running at "cache-buster-app"
|
25
25
|
When I go to "/cache-buster.html"
|
26
|
-
Then I should see "?"
|
26
|
+
Then I should see "site.css?"
|
27
|
+
Then I should see "blank.gif?"
|
@@ -4,12 +4,12 @@ Feature: Support coffee-script
|
|
4
4
|
Scenario: Rendering coffee script
|
5
5
|
Given the Server is running at "coffeescript-app"
|
6
6
|
When I go to "/javascripts/coffee_test.js"
|
7
|
-
Then I should see "
|
7
|
+
Then I should see ".slice"
|
8
8
|
|
9
9
|
Scenario: Rendering coffee-script with :coffeescript haml-filter
|
10
10
|
Given the Server is running at "coffeescript-app"
|
11
11
|
When I go to "/inline-coffeescript.html"
|
12
|
-
Then I should see "
|
12
|
+
Then I should see ".slice"
|
13
13
|
|
14
14
|
Scenario: Rendering broken coffee
|
15
15
|
Given the Server is running at "coffeescript-app"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: GZIP assets during build
|
2
|
+
|
3
|
+
Scenario: Built assets should be gzipped
|
4
|
+
Given a successfully built app at "gzip-app"
|
5
|
+
Then the following files should exist:
|
6
|
+
| build/javascripts/test.js.gz |
|
7
|
+
| build/stylesheets/test.css.gz |
|
8
|
+
| build/index.html.gz |
|
9
|
+
| build/javascripts/test.js |
|
10
|
+
| build/stylesheets/test.css |
|
11
|
+
| build/index.html |
|
12
|
+
When I run `file build/javascripts/test.js.gz`
|
13
|
+
Then the output should contain "gzip"
|
14
|
+
|
15
|
+
Scenario: Preview server doesn't change
|
16
|
+
Given the Server is running at "gzip-app"
|
17
|
+
When I go to "/javascripts/test.js"
|
18
|
+
Then I should see "test_function"
|
19
|
+
When I go to "/stylesheets/test.css"
|
20
|
+
Then I should see "test_selector"
|
21
|
+
|
File without changes
|
data/features/minify_css.feature
CHANGED
@@ -1,19 +1,67 @@
|
|
1
1
|
Feature: Minify CSS
|
2
2
|
In order reduce bytes sent to client and appease YSlow
|
3
3
|
|
4
|
+
Background:
|
5
|
+
Given current environment is "build"
|
6
|
+
|
4
7
|
Scenario: Rendering external css with the feature disabled
|
5
8
|
Given "minify_css" feature is "disabled"
|
6
9
|
And the Server is running at "minify-css-app"
|
7
10
|
When I go to "/stylesheets/site.css"
|
8
|
-
Then I should see "
|
11
|
+
Then I should see "60" lines
|
12
|
+
And I should see "only screen and (device-width"
|
9
13
|
|
10
14
|
Scenario: Rendering external css with the feature enabled
|
11
15
|
Given "minify_css" feature is "enabled"
|
12
16
|
And the Server is running at "minify-css-app"
|
13
17
|
When I go to "/stylesheets/site.css"
|
14
18
|
Then I should see "1" lines
|
19
|
+
And I should see "only screen and (device-width"
|
20
|
+
When I go to "/more-css/site.css"
|
21
|
+
Then I should see "1" lines
|
15
22
|
|
16
23
|
Scenario: Rendering external css with passthrough compressor
|
17
24
|
Given the Server is running at "passthrough-app"
|
18
25
|
When I go to "/stylesheets/site.css"
|
19
|
-
Then I should see "55" lines
|
26
|
+
Then I should see "55" lines
|
27
|
+
|
28
|
+
Scenario: Rendering inline css with the feature disabled
|
29
|
+
Given "minify_css" feature is "disabled"
|
30
|
+
And the Server is running at "minify-css-app"
|
31
|
+
When I go to "/inline-css.html"
|
32
|
+
Then I should see:
|
33
|
+
"""
|
34
|
+
<style type='text/css'>
|
35
|
+
/*<![CDATA[*/
|
36
|
+
body {
|
37
|
+
test: style;
|
38
|
+
good: deal;
|
39
|
+
}
|
40
|
+
/*]]>*/
|
41
|
+
</style>
|
42
|
+
"""
|
43
|
+
|
44
|
+
Scenario: Rendering inline css with a passthrough minifier
|
45
|
+
Given the Server is running at "passthrough-app"
|
46
|
+
When I go to "/inline-css.html"
|
47
|
+
Then I should see:
|
48
|
+
"""
|
49
|
+
<style type='text/css'>
|
50
|
+
body {
|
51
|
+
test: style;
|
52
|
+
good: deal; }
|
53
|
+
</style>
|
54
|
+
"""
|
55
|
+
|
56
|
+
Scenario: Rendering inline css with the feature enabled
|
57
|
+
Given "minify_css" feature is "enabled"
|
58
|
+
And the Server is running at "minify-css-app"
|
59
|
+
When I go to "/inline-css.html"
|
60
|
+
Then I should see:
|
61
|
+
"""
|
62
|
+
<style type='text/css'>
|
63
|
+
/*<![CDATA[*/
|
64
|
+
body{test:style;good:deal}
|
65
|
+
/*]]>*/
|
66
|
+
</style>
|
67
|
+
"""
|
@@ -8,24 +8,106 @@ Feature: Minify Javascript
|
|
8
8
|
Given "minify_javascript" feature is "disabled"
|
9
9
|
And the Server is running at "minify-js-app"
|
10
10
|
When I go to "/inline-js.html"
|
11
|
-
Then I should see
|
11
|
+
Then I should see:
|
12
|
+
"""
|
13
|
+
<script type='text/javascript'>
|
14
|
+
//<![CDATA[
|
15
|
+
;(function() {
|
16
|
+
this;
|
17
|
+
should();
|
18
|
+
all.be();
|
19
|
+
on = { one: line };
|
20
|
+
})();
|
21
|
+
//]]>
|
22
|
+
</script>
|
23
|
+
<script>
|
24
|
+
;(function() {
|
25
|
+
this;
|
26
|
+
should();
|
27
|
+
too();
|
28
|
+
})();
|
29
|
+
</script>
|
30
|
+
<script type='text/javascript'>
|
31
|
+
//<!--
|
32
|
+
;(function() {
|
33
|
+
one;
|
34
|
+
line();
|
35
|
+
here();
|
36
|
+
})();
|
37
|
+
//-->
|
38
|
+
</script>
|
39
|
+
<script type='text/html'>
|
40
|
+
I'm a jQuery {{template}}.
|
41
|
+
</script>
|
42
|
+
"""
|
12
43
|
|
13
44
|
Scenario: Rendering inline js with a passthrough minifier
|
14
45
|
Given the Server is running at "passthrough-app"
|
15
46
|
When I go to "/inline-js.html"
|
16
|
-
Then I should see
|
47
|
+
Then I should see:
|
48
|
+
"""
|
49
|
+
<script type='text/javascript'>
|
50
|
+
//<![CDATA[
|
51
|
+
;(function() {
|
52
|
+
this;
|
53
|
+
should();
|
54
|
+
all.be();
|
55
|
+
on = { one: line };
|
56
|
+
})();
|
57
|
+
//]]>
|
58
|
+
</script>
|
59
|
+
<script>
|
60
|
+
;(function() {
|
61
|
+
this;
|
62
|
+
should();
|
63
|
+
too();
|
64
|
+
})();
|
65
|
+
</script>
|
66
|
+
<script type='text/javascript'>
|
67
|
+
//<!--
|
68
|
+
;(function() {
|
69
|
+
one;
|
70
|
+
line();
|
71
|
+
here();
|
72
|
+
})();
|
73
|
+
//-->
|
74
|
+
</script>
|
75
|
+
<script type='text/html'>
|
76
|
+
I'm a jQuery {{template}}.
|
77
|
+
</script>
|
78
|
+
"""
|
17
79
|
|
18
80
|
Scenario: Rendering inline js with the feature enabled
|
19
81
|
Given "minify_javascript" feature is "enabled"
|
20
82
|
And the Server is running at "minify-js-app"
|
21
83
|
When I go to "/inline-js.html"
|
22
|
-
Then I should see
|
84
|
+
Then I should see:
|
85
|
+
"""
|
86
|
+
<script type='text/javascript'>
|
87
|
+
//<![CDATA[
|
88
|
+
(function(){this,should(),all.be(),on={one:line}})();
|
89
|
+
//]]>
|
90
|
+
</script>
|
91
|
+
<script>
|
92
|
+
(function(){this,should(),too()})();
|
93
|
+
</script>
|
94
|
+
<script type='text/javascript'>
|
95
|
+
//<!--
|
96
|
+
(function(){one,line(),here()})();
|
97
|
+
//-->
|
98
|
+
</script>
|
99
|
+
<script type='text/html'>
|
100
|
+
I'm a jQuery {{template}}.
|
101
|
+
</script>
|
102
|
+
"""
|
23
103
|
|
24
104
|
Scenario: Rendering external js with the feature enabled
|
25
105
|
Given "minify_javascript" feature is "enabled"
|
26
106
|
And the Server is running at "minify-js-app"
|
27
107
|
When I go to "/javascripts/js_test.js"
|
28
108
|
Then I should see "1" lines
|
109
|
+
When I go to "/more-js/other.js"
|
110
|
+
Then I should see "1" lines
|
29
111
|
|
30
112
|
Scenario: Rendering external js with a passthrough minifier
|
31
113
|
And the Server is running at "passthrough-app"
|
@@ -36,7 +118,7 @@ Feature: Minify Javascript
|
|
36
118
|
Given "minify_javascript" feature is "enabled"
|
37
119
|
And the Server is running at "minify-js-app"
|
38
120
|
When I go to "/inline-coffeescript.html"
|
39
|
-
Then I should see "
|
121
|
+
Then I should see "6" lines
|
40
122
|
|
41
123
|
Scenario: Rendering external js (coffeescript) with the feature enabled
|
42
124
|
Given "minify_javascript" feature is "enabled"
|
@@ -47,9 +129,10 @@ Feature: Minify Javascript
|
|
47
129
|
Scenario: Rendering inline js (coffeescript) with a passthrough minifier
|
48
130
|
Given the Server is running at "passthrough-app"
|
49
131
|
When I go to "/inline-coffeescript.html"
|
50
|
-
Then I should see "
|
132
|
+
Then I should see "16" lines
|
51
133
|
|
52
134
|
Scenario: Rendering external js (coffeescript) with a passthrough minifier
|
53
135
|
And the Server is running at "passthrough-app"
|
54
136
|
When I go to "/javascripts/coffee_test.js"
|
55
|
-
Then I should see "11" lines
|
137
|
+
Then I should see "11" lines
|
138
|
+
|
@@ -1,12 +1,21 @@
|
|
1
1
|
Feature: Relative Assets
|
2
2
|
In order easily switch between relative and absolute paths
|
3
3
|
|
4
|
-
Scenario:
|
4
|
+
Scenario: Previewing css with the feature disabled
|
5
5
|
Given "relative_assets" feature is "disabled"
|
6
6
|
And the Server is running at "relative-assets-app"
|
7
7
|
When I go to "/stylesheets/relative_assets.css"
|
8
8
|
Then I should not see "url('../"
|
9
|
-
And I should see "/images/blank.gif"
|
9
|
+
And I should see "/images/blank.gif')"
|
10
|
+
|
11
|
+
Scenario: Building css with the feature disabled
|
12
|
+
Given a fixture app "relative-assets-app"
|
13
|
+
And a file named "config.rb" with:
|
14
|
+
"""
|
15
|
+
"""
|
16
|
+
Given a successfully built app at "relative-assets-app"
|
17
|
+
When I cd to "build"
|
18
|
+
Then the file "stylesheets/relative_assets.css" should contain "url('/images/blank.gif')"
|
10
19
|
|
11
20
|
Scenario: Rendering html with the feature disabled
|
12
21
|
Given "relative_assets" feature is "disabled"
|
@@ -20,6 +29,27 @@ Feature: Relative Assets
|
|
20
29
|
When I go to "/stylesheets/relative_assets.css"
|
21
30
|
Then I should see "url('../images/blank.gif"
|
22
31
|
|
32
|
+
Scenario: Building css with the feature enabled
|
33
|
+
Given a fixture app "relative-assets-app"
|
34
|
+
And a file named "config.rb" with:
|
35
|
+
"""
|
36
|
+
activate :relative_assets
|
37
|
+
"""
|
38
|
+
Given a successfully built app at "relative-assets-app"
|
39
|
+
When I cd to "build"
|
40
|
+
Then the file "stylesheets/relative_assets.css" should contain "url('../images/blank.gif')"
|
41
|
+
|
42
|
+
Scenario: Relative css reference with directory indexes
|
43
|
+
Given a fixture app "relative-assets-app"
|
44
|
+
And a file named "config.rb" with:
|
45
|
+
"""
|
46
|
+
activate :directory_indexes
|
47
|
+
activate :relative_assets
|
48
|
+
"""
|
49
|
+
Given a successfully built app at "relative-assets-app"
|
50
|
+
When I cd to "build"
|
51
|
+
Then the file "relative_image/index.html" should contain "../stylesheets/relative_assets.css"
|
52
|
+
|
23
53
|
Scenario: Rendering html with the feature enabled
|
24
54
|
Given "relative_assets" feature is "enabled"
|
25
55
|
And the Server is running at "relative-assets-app"
|
@@ -27,14 +57,25 @@ Feature: Relative Assets
|
|
27
57
|
Then I should not see "/images/blank.gif"
|
28
58
|
And I should see "images/blank.gif"
|
29
59
|
|
30
|
-
Scenario: Rendering
|
60
|
+
Scenario: Rendering css with a custom images_dir
|
31
61
|
Given "relative_assets" feature is "enabled"
|
32
62
|
And "images_dir" is set to "img"
|
33
63
|
And the Server is running at "relative-assets-app"
|
34
64
|
When I go to "/stylesheets/relative_assets.css"
|
35
|
-
Then I should see "url('../img/blank.gif"
|
65
|
+
Then I should see "url('../img/blank.gif')"
|
36
66
|
|
37
|
-
Scenario:
|
67
|
+
Scenario: Building css with a custom images_dir
|
68
|
+
Given a fixture app "relative-assets-app"
|
69
|
+
And a file named "config.rb" with:
|
70
|
+
"""
|
71
|
+
set :images_dir, "img"
|
72
|
+
activate :relative_assets
|
73
|
+
"""
|
74
|
+
Given a successfully built app at "relative-assets-app"
|
75
|
+
When I cd to "build"
|
76
|
+
Then the file "stylesheets/relative_assets.css" should contain "url('../img/blank.gif')"
|
77
|
+
|
78
|
+
Scenario: Rendering html with a custom images_dir
|
38
79
|
Given "relative_assets" feature is "enabled"
|
39
80
|
And "images_dir" is set to "img"
|
40
81
|
And the Server is running at "relative-assets-app"
|
@@ -47,4 +88,4 @@ Feature: Relative Assets
|
|
47
88
|
Given "relative_assets" feature is "enabled"
|
48
89
|
And the Server is running at "fonts-app"
|
49
90
|
When I go to "/stylesheets/fonts.css"
|
50
|
-
Then I should see "url('../fonts/StMarie"
|
91
|
+
Then I should see "url('../fonts/StMarie-Thin.otf"
|