middleman-core-with-external-sources-watch-fix 4.1.0 → 4.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/asset_hash.feature +47 -10
- data/features/builder.feature +8 -4
- data/features/collections.feature +27 -0
- data/features/custom_layouts.feature +17 -1
- data/features/dynamic_pages.feature +15 -12
- data/features/front-matter-neighbor.feature +6 -2
- data/features/helpers_link_to.feature +11 -1
- data/features/i18n_link_to.feature +34 -34
- data/features/markdown_redcarpet_in_slim.feature +41 -0
- data/features/page-id.feature +26 -0
- data/features/partials.feature +17 -5
- data/features/relative_assets.feature +1 -1
- data/features/relative_assets_helpers_only.feature +123 -0
- data/features/sass_in_slim.feature +40 -0
- data/features/template-key-collision.feature +26 -0
- data/fixtures/asset-hash-minified-app/source/images/100px.jpg +0 -0
- data/fixtures/asset-hash-minified-app/source/stylesheets/test.css +3 -0
- data/fixtures/asset-hash-prefix/config.rb +7 -0
- data/fixtures/asset-hash-prefix/lib/middleware.rb +16 -0
- data/fixtures/asset-hash-prefix/source/index.html.erb +6 -0
- data/fixtures/asset-hash-prefix/source/javascripts/application.js +2 -0
- data/fixtures/asset-hash-prefix/source/javascripts/application.js.map +1 -0
- data/fixtures/asset-hash-prefix/source/layout.erb +17 -0
- data/fixtures/asset-hash-source-map/config.rb +6 -0
- data/fixtures/asset-hash-source-map/lib/middleware.rb +16 -0
- data/fixtures/asset-hash-source-map/source/index.html.erb +6 -0
- data/fixtures/asset-hash-source-map/source/javascripts/application.js +2 -0
- data/fixtures/asset-hash-source-map/source/javascripts/application.js.map +1 -0
- data/fixtures/asset-hash-source-map/source/layout.erb +17 -0
- data/fixtures/asset-host-app/source/images/blank0.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank10.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank100.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank101.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1010.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank102.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1020.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1021.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1022.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1023.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1024.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank103.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1030.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1031.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1032.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1033.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1034.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank104.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1043.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank1054.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank2.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank20.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank21.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank22.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank23.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank24.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank3.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank30.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank31.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank32.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank33.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank34.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank4.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank43.gif +0 -0
- data/fixtures/asset-host-app/source/images/blank54.gif +0 -0
- data/fixtures/dynamic-pages-app/config.rb +4 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored9.html +1 -0
- data/fixtures/external-pipeline-error/config.rb +5 -0
- data/fixtures/external-pipeline-error/source/javascripts/file.js +0 -0
- data/fixtures/page-id-app/config.rb +5 -0
- data/fixtures/page-id-app/source/fm.html.erb +5 -0
- data/fixtures/page-id-app/source/index.html.erb +6 -0
- data/fixtures/page-id-app/source/overwrites/from-default.html.erb +1 -0
- data/fixtures/page-id-app/source/overwrites/from-frontmatter.html.erb +5 -0
- data/fixtures/partials-app/source/_block.erb +3 -0
- data/fixtures/partials-app/source/block.html.erb +3 -0
- data/fixtures/partials-app/source/index_missing.html.erb +3 -0
- data/fixtures/relative-assets-app/source/images/blank2.gif +0 -0
- data/fixtures/sass-in-slim-app/config.rb +0 -0
- data/lib/middleman-core/application.rb +30 -4
- data/lib/middleman-core/builder.rb +8 -2
- data/lib/middleman-core/config_context.rb +5 -1
- data/lib/middleman-core/configuration.rb +1 -1
- data/lib/middleman-core/core_extensions/collections.rb +28 -17
- data/lib/middleman-core/core_extensions/collections/step_context.rb +14 -7
- data/lib/middleman-core/core_extensions/data.rb +4 -2
- data/lib/middleman-core/core_extensions/default_helpers.rb +1 -0
- data/lib/middleman-core/core_extensions/front_matter.rb +8 -6
- data/lib/middleman-core/core_extensions/i18n.rb +3 -1
- data/lib/middleman-core/core_extensions/inline_url_rewriter.rb +20 -35
- data/lib/middleman-core/core_extensions/routing.rb +6 -3
- data/lib/middleman-core/extension.rb +41 -6
- data/lib/middleman-core/extensions.rb +2 -2
- data/lib/middleman-core/extensions/asset_hash.rb +10 -5
- data/lib/middleman-core/extensions/asset_host.rb +4 -3
- data/lib/middleman-core/extensions/cache_buster.rb +2 -2
- data/lib/middleman-core/extensions/directory_indexes.rb +8 -2
- data/lib/middleman-core/extensions/external_pipeline.rb +54 -8
- data/lib/middleman-core/extensions/minify_css.rb +9 -1
- data/lib/middleman-core/extensions/minify_javascript.rb +8 -0
- data/lib/middleman-core/extensions/relative_assets.rb +38 -13
- data/lib/middleman-core/file_renderer.rb +4 -4
- data/lib/middleman-core/load_paths.rb +3 -1
- data/lib/middleman-core/logger.rb +1 -1
- data/lib/middleman-core/meta_pages/templates/index.html.erb +3 -1
- data/lib/middleman-core/preview_server.rb +25 -18
- data/lib/middleman-core/rack.rb +2 -0
- data/lib/middleman-core/renderers/redcarpet.rb +2 -2
- data/lib/middleman-core/renderers/sass_functions.rb +4 -6
- data/lib/middleman-core/renderers/slim.rb +1 -5
- data/lib/middleman-core/sitemap/extensions/import.rb +2 -2
- data/lib/middleman-core/sitemap/extensions/proxies.rb +4 -1
- data/lib/middleman-core/sitemap/extensions/redirects.rb +1 -2
- data/lib/middleman-core/sitemap/resource.rb +15 -5
- data/lib/middleman-core/sitemap/store.rb +33 -2
- data/lib/middleman-core/sources.rb +2 -1
- data/lib/middleman-core/sources/source_watcher.rb +17 -6
- data/lib/middleman-core/template_context.rb +26 -21
- data/lib/middleman-core/template_renderer.rb +22 -9
- data/lib/middleman-core/util/binary.rb +4 -5
- data/lib/middleman-core/util/data.rb +33 -18
- data/lib/middleman-core/util/files.rb +27 -24
- data/lib/middleman-core/util/paths.rb +74 -14
- data/lib/middleman-core/util/rack.rb +16 -6
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core.gemspec +11 -8
- data/spec/middleman-core/core_extensions/data_spec.rb +107 -1
- data/spec/middleman-core/util_spec.rb +37 -0
- metadata +196 -18
@@ -0,0 +1,41 @@
|
|
1
|
+
Feature: Markdown support in Slim
|
2
|
+
In order to test support of the Slim markdown filter
|
3
|
+
|
4
|
+
Scenario: Markdown filter in Slim works
|
5
|
+
Given a fixture app "markdown-in-slim-app"
|
6
|
+
And a file named "config.rb" with:
|
7
|
+
"""
|
8
|
+
set :markdown_engine, :redcarpet
|
9
|
+
activate :directory_indexes
|
10
|
+
"""
|
11
|
+
And a file named "source/markdown_filter.html.slim" with:
|
12
|
+
"""
|
13
|
+
markdown:
|
14
|
+
# H1
|
15
|
+
|
16
|
+
paragraph
|
17
|
+
"""
|
18
|
+
Given the Server is running at "markdown-in-slim-app"
|
19
|
+
When I go to "/markdown_filter/"
|
20
|
+
Then I should see ">H1</h1>"
|
21
|
+
Then I should see "<p>paragraph</p>"
|
22
|
+
|
23
|
+
|
24
|
+
Scenario: Markdown filter in Slim uses our link_to and image_tag helpers
|
25
|
+
Given a fixture app "markdown-in-slim-app"
|
26
|
+
And a file named "config.rb" with:
|
27
|
+
"""
|
28
|
+
set :markdown_engine, :redcarpet
|
29
|
+
activate :directory_indexes
|
30
|
+
"""
|
31
|
+
And a file named "source/link_and_image.html.slim" with:
|
32
|
+
"""
|
33
|
+
markdown:
|
34
|
+
[A link](/link_target.html)
|
35
|
+
|
36
|
+
![image](blank.gif)
|
37
|
+
"""
|
38
|
+
Given the Server is running at "markdown-in-slim-app"
|
39
|
+
When I go to "/link_and_image/"
|
40
|
+
Then I should see "/link_target/"
|
41
|
+
Then I should see 'src="/images/blank.gif"'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Feature: Page IDs
|
2
|
+
|
3
|
+
Scenario: link_to works with blocks (erb)
|
4
|
+
Given the Server is running at "page-id-app"
|
5
|
+
When I go to "/index.html"
|
6
|
+
Then I should see "I am: index.html"
|
7
|
+
And I should see "URL1: /fm.html"
|
8
|
+
And I should see "URL2: /2.html"
|
9
|
+
And I should see 'URL3: <a href="/3.html">Hi</a>'
|
10
|
+
And I should see 'URL4: <a href="/overwrites/from-default.html">Sym</a>'
|
11
|
+
|
12
|
+
When I go to "/fm.html"
|
13
|
+
Then I should see "I am: frontmatter"
|
14
|
+
|
15
|
+
When I go to "/1.html"
|
16
|
+
Then I should see "I am: page1"
|
17
|
+
When I go to "/2.html"
|
18
|
+
Then I should see "I am: page2"
|
19
|
+
When I go to "/3.html"
|
20
|
+
Then I should see "I am: page3"
|
21
|
+
|
22
|
+
When I go to "/overwrites/from-default.html"
|
23
|
+
Then I should see "I am: something-else"
|
24
|
+
|
25
|
+
When I go to "/overwrites/from-frontmatter.html"
|
26
|
+
Then I should see "I am: from_frontmatter"
|
data/features/partials.feature
CHANGED
@@ -5,25 +5,30 @@ Feature: Provide Sane Defaults for Partial Behavior
|
|
5
5
|
When I go to "/index.html"
|
6
6
|
Then I should see "Header"
|
7
7
|
And I should see "Footer"
|
8
|
-
|
8
|
+
|
9
9
|
Scenario: Finds shared partials relative to the root (sub)
|
10
10
|
Given the Server is running at "partials-app"
|
11
11
|
When I go to "/sub/index.html"
|
12
12
|
Then I should see "Header"
|
13
13
|
And I should see "Footer"
|
14
|
-
|
14
|
+
|
15
|
+
Scenario: Flags error when partial is not found
|
16
|
+
Given the Server is running at "partials-app"
|
17
|
+
When I go to "/index_missing.html"
|
18
|
+
Then I should see "Error: Could not locate partial"
|
19
|
+
|
15
20
|
Scenario: Prefers partials of the same engine type
|
16
21
|
Given the Server is running at "partials-app"
|
17
22
|
When I go to "/index.html"
|
18
23
|
Then I should see "ERb Main"
|
19
|
-
|
24
|
+
|
20
25
|
Scenario: Prefers partials of the same engine type
|
21
26
|
Given the Server is running at "partials-app"
|
22
27
|
When I go to "/second.html"
|
23
28
|
Then I should see "Str Main"
|
24
29
|
And I should see "Header"
|
25
30
|
And I should see "Footer"
|
26
|
-
|
31
|
+
|
27
32
|
Scenario: Finds partial relative to template
|
28
33
|
Given the Server is running at "partials-app"
|
29
34
|
When I go to "/sub/index.html"
|
@@ -33,7 +38,7 @@ Feature: Provide Sane Defaults for Partial Behavior
|
|
33
38
|
Given the Server is running at "partials-app"
|
34
39
|
When I go to "/locals.html"
|
35
40
|
Then I should see "Local var is bar"
|
36
|
-
|
41
|
+
|
37
42
|
Scenario: Partial and Layout use different engines
|
38
43
|
Given the Server is running at "different-engine-partial"
|
39
44
|
When I go to "/index.html"
|
@@ -50,3 +55,10 @@ Feature: Provide Sane Defaults for Partial Behavior
|
|
50
55
|
Then I should see "File Not Found"
|
51
56
|
When I go to "/_code_snippet.html"
|
52
57
|
Then I should see "File Not Found"
|
58
|
+
|
59
|
+
Scenario: Works with blocks
|
60
|
+
Given the Server is running at "partials-app"
|
61
|
+
When I go to "/block.html"
|
62
|
+
Then I should see "Start"
|
63
|
+
And I should see "Contents"
|
64
|
+
And I should see "End"
|
@@ -120,7 +120,7 @@ Feature: Relative Assets
|
|
120
120
|
"""
|
121
121
|
And the Server is running at "relative-assets-app"
|
122
122
|
When I go to "/sub/image_tag.html"
|
123
|
-
Then I should see '<img src="../img/blank.gif"
|
123
|
+
Then I should see '<img src="../img/blank.gif"'
|
124
124
|
|
125
125
|
Scenario: Relative assets should not break data URIs in image_tag
|
126
126
|
Given a fixture app "relative-assets-app"
|
@@ -0,0 +1,123 @@
|
|
1
|
+
Feature: Relative Assets (Helpers Only)
|
2
|
+
|
3
|
+
Scenario: Rendering css with the feature enabled
|
4
|
+
Given a fixture app "relative-assets-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :relative_assets, helpers_only: true
|
8
|
+
"""
|
9
|
+
And a file named "source/stylesheets/relative_assets.css.sass.erb" with:
|
10
|
+
"""
|
11
|
+
h1
|
12
|
+
background: url("<%= asset_url('images/blank.gif') %>")
|
13
|
+
h2
|
14
|
+
background: url("<%= asset_url('/images/blank2.gif') %>")
|
15
|
+
"""
|
16
|
+
And a file named "source/javascripts/application.js.erb" with:
|
17
|
+
"""
|
18
|
+
function foo() {
|
19
|
+
var img = document.createElement('img');
|
20
|
+
img.src = '<%= asset_url("images/100px.jpg") %>';
|
21
|
+
var body = document.getElementsByTagName('body')[0];
|
22
|
+
body.insertBefore(img, body.firstChild);
|
23
|
+
}
|
24
|
+
|
25
|
+
window.onload = foo;
|
26
|
+
"""
|
27
|
+
And a file named "source/stylesheets/fonts3.css.erb" with:
|
28
|
+
"""
|
29
|
+
@font-face {
|
30
|
+
font-family: 'Roboto2';
|
31
|
+
src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>);
|
32
|
+
src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'),
|
33
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'),
|
34
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'),
|
35
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg');
|
36
|
+
font-weight: normal;
|
37
|
+
font-style: normal;
|
38
|
+
}
|
39
|
+
"""
|
40
|
+
And the Server is running at "relative-assets-app"
|
41
|
+
When I go to "/stylesheets/relative_assets.css"
|
42
|
+
Then I should see 'url("../images/blank.gif'
|
43
|
+
And I should see 'url("../images/blank2.gif'
|
44
|
+
When I go to "/javascripts/application.js"
|
45
|
+
Then I should not see "../"
|
46
|
+
When I go to "/stylesheets/fonts3.css"
|
47
|
+
Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot'
|
48
|
+
And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff'
|
49
|
+
And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf'
|
50
|
+
And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg'
|
51
|
+
|
52
|
+
Scenario: Relative css reference with directory indexes
|
53
|
+
Given a fixture app "relative-assets-app"
|
54
|
+
And a file named "config.rb" with:
|
55
|
+
"""
|
56
|
+
activate :directory_indexes
|
57
|
+
activate :relative_assets, helpers_only: true
|
58
|
+
"""
|
59
|
+
And the Server is running at "relative-assets-app"
|
60
|
+
When I go to "/relative_image/index.html"
|
61
|
+
Then I should see "../stylesheets/relative_assets.css"
|
62
|
+
|
63
|
+
Scenario: Relative assets via image_tag
|
64
|
+
Given a fixture app "relative-assets-app"
|
65
|
+
And a file named "config.rb" with:
|
66
|
+
"""
|
67
|
+
activate :relative_assets, helpers_only: true
|
68
|
+
"""
|
69
|
+
And a file named "source/sub/image_tag.html.erb" with:
|
70
|
+
"""
|
71
|
+
<%= image_tag '/img/blank.gif' %>
|
72
|
+
"""
|
73
|
+
And the Server is running at "relative-assets-app"
|
74
|
+
When I go to "/sub/image_tag.html"
|
75
|
+
Then I should see '<img src="../img/blank.gif"'
|
76
|
+
|
77
|
+
Scenario: Relative assets should not break data URIs in image_tag
|
78
|
+
Given a fixture app "relative-assets-app"
|
79
|
+
And a file named "config.rb" with:
|
80
|
+
"""
|
81
|
+
activate :relative_assets, helpers_only: true
|
82
|
+
"""
|
83
|
+
And a file named "source/sub/image_tag.html.erb" with:
|
84
|
+
"""
|
85
|
+
<%= image_tag "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" %>
|
86
|
+
"""
|
87
|
+
And the Server is running at "relative-assets-app"
|
88
|
+
When I go to "/sub/image_tag.html"
|
89
|
+
Then I should see '<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />'
|
90
|
+
|
91
|
+
Scenario: URLs are not rewritten for rewrite ignored paths
|
92
|
+
Given a fixture app "relative-assets-app"
|
93
|
+
And a file named "config.rb" with:
|
94
|
+
"""
|
95
|
+
activate :relative_assets, rewrite_ignore: [
|
96
|
+
'/stylesheets/fonts3.css',
|
97
|
+
], helpers_only: true
|
98
|
+
"""
|
99
|
+
And a file named "source/stylesheets/relative_assets.css.sass.erb" with:
|
100
|
+
"""
|
101
|
+
h1
|
102
|
+
background: url("<%= asset_url('images/blank.gif') %>")
|
103
|
+
h2
|
104
|
+
background: url("<%= asset_url('/images/blank2.gif') %>")
|
105
|
+
"""
|
106
|
+
And a file named "source/stylesheets/fonts3.css.erb" with:
|
107
|
+
"""
|
108
|
+
@font-face {
|
109
|
+
font-family: 'Roboto2';
|
110
|
+
src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>);
|
111
|
+
src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'),
|
112
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'),
|
113
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'),
|
114
|
+
url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg');
|
115
|
+
font-weight: normal;
|
116
|
+
font-style: normal;
|
117
|
+
}
|
118
|
+
"""
|
119
|
+
And the Server is running at "relative-assets-app"
|
120
|
+
When I go to "/stylesheets/relative_assets.css"
|
121
|
+
Then I should see 'url("../images/blank.gif'
|
122
|
+
When I go to "/stylesheets/fonts3.css"
|
123
|
+
Then I should see 'url(/fonts/roboto/roboto-regular-webfont.eot'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Sass/SCSS support in Slim
|
2
|
+
In order to test support of the Slim sass and scss filters
|
3
|
+
|
4
|
+
Scenario: Sass filter in Slim works
|
5
|
+
Given a fixture app "sass-in-slim-app"
|
6
|
+
And a file named "config.rb" with:
|
7
|
+
"""
|
8
|
+
activate :directory_indexes
|
9
|
+
"""
|
10
|
+
And a file named "source/sass_filter.html.slim" with:
|
11
|
+
"""
|
12
|
+
sass:
|
13
|
+
.sass
|
14
|
+
margin: 0
|
15
|
+
"""
|
16
|
+
Given the Server is running at "sass-in-slim-app"
|
17
|
+
When I go to "/sass_filter/"
|
18
|
+
Then I should see "text/css"
|
19
|
+
Then I should see ".sass"
|
20
|
+
Then I should see "margin:0"
|
21
|
+
|
22
|
+
|
23
|
+
Scenario: SCSS filter in Slim works
|
24
|
+
Given a fixture app "sass-in-slim-app"
|
25
|
+
And a file named "config.rb" with:
|
26
|
+
"""
|
27
|
+
activate :directory_indexes
|
28
|
+
"""
|
29
|
+
And a file named "source/scss_filter.html.slim" with:
|
30
|
+
"""
|
31
|
+
scss:
|
32
|
+
.scss {
|
33
|
+
margin: 0;
|
34
|
+
}
|
35
|
+
"""
|
36
|
+
Given the Server is running at "sass-in-slim-app"
|
37
|
+
When I go to "/scss_filter/"
|
38
|
+
Then I should see "text/css"
|
39
|
+
Then I should see ".scss"
|
40
|
+
Then I should see "margin:0"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Feature: Don't allow template locals to overwrite template helpers
|
2
|
+
|
3
|
+
Scenario: Normal Template
|
4
|
+
Given an empty app
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
class TestExt < ::Middleman::Extension
|
8
|
+
expose_to_template foo: :foo
|
9
|
+
|
10
|
+
def foo
|
11
|
+
"bar"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
::Middleman::Extensions.register :test, TestExt
|
16
|
+
|
17
|
+
activate :test
|
18
|
+
|
19
|
+
page "/index.html", locals: { foo: false }
|
20
|
+
"""
|
21
|
+
And a file named "source/index.html.erb" with:
|
22
|
+
"""
|
23
|
+
<%= foo %>
|
24
|
+
"""
|
25
|
+
Given a built app at "empty_app"
|
26
|
+
Then the exit status should be 1
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Middleware
|
2
|
+
def initialize(app)
|
3
|
+
@app = app
|
4
|
+
end
|
5
|
+
|
6
|
+
def call(env)
|
7
|
+
status, headers, response = @app.call(env)
|
8
|
+
body = ''
|
9
|
+
response.each {|part| body += part }
|
10
|
+
if (env["PATH_INFO"] =~ /css$/)
|
11
|
+
body += "\n/* Added by Rack filter */"
|
12
|
+
status, headers, response = Rack::Response.new(body, status, headers).finish
|
13
|
+
end
|
14
|
+
[status, headers, response]
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["source/javascripts/application.js"],"names":["foo","message","para","document","createElement","innerHTML","body","getElementsByTagName","insertBefore","firstChild","window","onload"],"mappings":"AAAA,QAASA,OACP,GAAIC,SAAU,mBACd,IAAIC,MAAOC,SAASC,cAAc,IAClCF,MAAKG,UAAYJ,OACb,IAAIK,MAAOH,SAASI,qBAAqB,QAAQ,EAC/CD,MAAKE,aAAaN,KAAMI,KAAKG,YAGpCC,OAAOC,OAASX"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= yield_content :head %>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body class="<%= page_classes %>">
|
11
|
+
|
12
|
+
<div id="main" role="main">
|
13
|
+
<%= yield %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Middleware
|
2
|
+
def initialize(app)
|
3
|
+
@app = app
|
4
|
+
end
|
5
|
+
|
6
|
+
def call(env)
|
7
|
+
status, headers, response = @app.call(env)
|
8
|
+
body = ''
|
9
|
+
response.each {|part| body += part }
|
10
|
+
if (env["PATH_INFO"] =~ /css$/)
|
11
|
+
body += "\n/* Added by Rack filter */"
|
12
|
+
status, headers, response = Rack::Response.new(body, status, headers).finish
|
13
|
+
end
|
14
|
+
[status, headers, response]
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["source/javascripts/application.js"],"names":["foo","message","para","document","createElement","innerHTML","body","getElementsByTagName","insertBefore","firstChild","window","onload"],"mappings":"AAAA,QAASA,OACP,GAAIC,SAAU,mBACd,IAAIC,MAAOC,SAASC,cAAc,IAClCF,MAAKG,UAAYJ,OACb,IAAIK,MAAOH,SAASI,qBAAqB,QAAQ,EAC/CD,MAAKE,aAAaN,KAAMI,KAAKG,YAGpCC,OAAOC,OAASX"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= yield_content :head %>
|
8
|
+
</head>
|
9
|
+
|
10
|
+
<body class="<%= page_classes %>">
|
11
|
+
|
12
|
+
<div id="main" role="main">
|
13
|
+
<%= yield %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|