middleman-sprockets 4.0.0.rc.1 → 4.0.0.rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +13 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +57 -0
- data/.simplecov +1 -1
- data/.travis.yml +26 -15
- data/CHANGELOG.md +15 -0
- data/Gemfile +25 -21
- data/README.md +60 -6
- data/Rakefile +31 -11
- data/docs/upgrade-3-to-4.md +118 -0
- data/features/asset_gems.feature +63 -0
- data/features/basic_usage.feature +97 -0
- data/features/bower.feature +90 -30
- data/features/linked_assets.feature +123 -0
- data/features/middleman_helpers.feature +154 -0
- data/features/step_definitions/builder_steps.rb +8 -0
- data/features/step_definitions/server_steps.rb +20 -0
- data/features/support/env.rb +0 -1
- data/features/{asset_hash.feature → test_cases/asset_hash.feature} +28 -22
- data/features/test_cases/exception_response.feature +31 -0
- data/features/test_cases/excluded_file_extensions.feature +39 -0
- data/features/test_cases/file_not_found.feature +31 -0
- data/features/test_cases/ignore_directive_is_respected.feature +90 -0
- data/features/test_cases/imported_asset_extensions.feature +77 -0
- data/features/test_cases/jst.feature +36 -0
- data/features/test_cases/long_filenames.feature +40 -0
- data/features/test_cases/path_helpers.feature +106 -0
- data/features/test_cases/processible_outside_asset_dir.feature +49 -0
- data/features/test_cases/sass_globs.feature +76 -0
- data/features/test_cases/sass_partials.feature +49 -0
- data/features/test_cases/sassc.feature +27 -0
- data/features/test_cases/use_from_templates.feature +21 -0
- data/features/test_cases/using_assets_gem_assets.feature +88 -0
- data/fixtures/asset-hash-app/config.rb +2 -0
- data/fixtures/asset-hash-app/source/stylesheets/jquery-mobile.css.scss +1 -0
- data/fixtures/asset-hash-host-app/config.rb +4 -4
- data/fixtures/base-app/config.rb +1 -0
- data/fixtures/{bower-multiple-assets-app/source/index.html → base-app/source/index.html.erb} +0 -0
- data/fixtures/gems/assets_gem/assets_gem.gemspec +16 -0
- data/fixtures/gems/assets_gem/lib/assets_gem.rb +7 -0
- data/fixtures/gems/assets_gem/vendor/assets/css/_imports/_import.scss +1 -0
- data/fixtures/{sprockets-imported-assets-match-multiple-paths-app/vendor/assets/css/test.css → gems/assets_gem/vendor/assets/css/test.scss} +1 -1
- data/fixtures/gems/assets_gem/vendor/assets/fonts/font.ttf +0 -0
- data/fixtures/gems/assets_gem/vendor/assets/images/logo.png +0 -0
- data/fixtures/gems/assets_gem/vendor/assets/javascripts/_imports/import.js +1 -0
- data/gemfiles/middleman-4.0.gemfile +7 -0
- data/gemfiles/middleman-4.1.gemfile +7 -0
- data/gemfiles/middleman-head.gemfile +7 -0
- data/gemfiles/sprockets-4.0.gemfile +6 -0
- data/lib/middleman-sprockets.rb +5 -5
- data/lib/middleman-sprockets/extension.rb +174 -215
- data/lib/middleman-sprockets/interface.rb +64 -0
- data/lib/middleman-sprockets/resource.rb +97 -0
- data/lib/middleman-sprockets/version.rb +1 -1
- data/middleman-sprockets.gemspec +16 -15
- data/tasks/matrix.rake +46 -0
- metadata +77 -237
- data/features/jst.feature +0 -14
- data/features/long_filenames.feature +0 -17
- data/features/sass_globs.feature +0 -9
- data/features/sass_partials.feature +0 -36
- data/features/sprockets.feature +0 -108
- data/features/sprockets_gems.feature +0 -48
- data/fixtures/asset-paths-app/config.rb +0 -1
- data/fixtures/asset-paths-app/derp/javascripts/vendored_js.js +0 -1
- data/fixtures/asset-paths-app/source/javascripts/vendored_include.js +0 -1
- data/fixtures/bower-app/bower.json +0 -7
- data/fixtures/bower-app/bower_components/underscore/bower.json +0 -8
- data/fixtures/bower-app/bower_components/underscore/underscore.js +0 -1343
- data/fixtures/bower-app/config.rb +0 -1
- data/fixtures/bower-app/source/javascripts/application.js +0 -1
- data/fixtures/bower-app/source/javascripts/import.js +0 -1
- data/fixtures/bower-individual-outputdir-app/bower.json +0 -7
- data/fixtures/bower-individual-outputdir-app/bower_components/underscore/bower.json +0 -8
- data/fixtures/bower-individual-outputdir-app/bower_components/underscore/underscore.js +0 -1343
- data/fixtures/bower-individual-outputdir-app/config.rb +0 -2
- data/fixtures/bower-individual-outputdir-app/source/javascripts/application.js +0 -4
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/.bower.json +0 -34
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/bower.json +0 -26
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/img/close.png +0 -0
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/js/lightbox.js +0 -2
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/package.json +0 -37
- data/fixtures/bower-json-app/config.rb +0 -1
- data/fixtures/bower-json-app/source/javascripts/application.js.coffee +0 -1
- data/fixtures/bower-json-app/source/javascripts/bower.json +0 -5
- data/fixtures/bower-multiple-assets-app/.bowerrc +0 -4
- data/fixtures/bower-multiple-assets-app/bower.json +0 -7
- data/fixtures/bower-multiple-assets-app/config.rb +0 -1
- data/fixtures/bower-multiple-assets-app/source/javascripts/core.js +0 -2
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/.bower.json +0 -34
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/bower.json +0 -26
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/img/close.png +0 -0
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/img/open.png +0 -0
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/js/lightbox.js +0 -2
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/package.json +0 -37
- data/fixtures/glob-app/config.rb +0 -0
- data/fixtures/glob-app/source/stylesheets/main.css.scss +0 -1
- data/fixtures/glob-app/source/stylesheets/module1/_i-am-mod.scss +0 -3
- data/fixtures/glob-app/source/stylesheets/module2/_derp.sass +0 -2
- data/fixtures/glob-app/source/stylesheets/shared/3rd-party/bootstrap.sass +0 -2
- data/fixtures/glob-app/source/stylesheets/shared/shared.scss +0 -3
- data/fixtures/jquery-mobile-app/config.rb +0 -0
- data/fixtures/jquery-mobile-app/source/javascripts/app.js +0 -1
- data/fixtures/jquery-mobile-app/source/stylesheets/base.css.scss +0 -2
- data/fixtures/long-filenames-app/config.rb +0 -0
- data/fixtures/long-filenames-app/source/images/00000000-0000-0000-0000-000000.svg +0 -3
- data/fixtures/long-filenames-app/source/images/00000000-0000-0000-0000-0000001.svg +0 -3
- data/fixtures/preview-app/config.rb +0 -0
- data/fixtures/preview-app/source/content.html.erb +0 -1
- data/fixtures/preview-app/source/layout.erb +0 -1
- data/fixtures/preview-app/source/stylesheets/_partial.sass +0 -2
- data/fixtures/preview-app/source/stylesheets/_partial2.css.sass +0 -2
- data/fixtures/preview-app/source/stylesheets/main.css.sass +0 -4
- data/fixtures/preview-app/source/stylesheets/main2.css.sass +0 -4
- data/fixtures/preview-app/source/stylesheets/plain.css.sass +0 -2
- data/fixtures/sprockets-app/config.rb +0 -2
- data/fixtures/sprockets-app/source/index.html.erb +0 -6
- data/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss +0 -1
- data/fixtures/sprockets-app/source/library/css/plain.css +0 -5
- data/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss +0 -1
- data/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss +0 -1
- data/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss +0 -1
- data/fixtures/sprockets-app/source/library/js/jquery_include.js +0 -1
- data/fixtures/sprockets-app/source/library/js/plain.js +0 -6
- data/fixtures/sprockets-app/source/library/js/sprockets_base.js +0 -5
- data/fixtures/sprockets-app/source/library/js/sprockets_sub.js +0 -3
- data/fixtures/sprockets-app/source/library/js/vendored_include.js +0 -1
- data/fixtures/sprockets-app/vendor/assets/javascripts/coffee.js.coffee +0 -2
- data/fixtures/sprockets-app/vendor/assets/javascripts/vendored_js.js +0 -1
- data/fixtures/sprockets-app/vendor/assets/stylesheets/vendored.css.scss +0 -4
- data/fixtures/sprockets-app2/config.rb +0 -0
- data/fixtures/sprockets-app2/data/test.yml +0 -4
- data/fixtures/sprockets-app2/data/test2.json +0 -4
- data/fixtures/sprockets-app2/source/javascripts/_templates/test.jst.ejs +0 -1
- data/fixtures/sprockets-app2/source/javascripts/_templates/test2.jst.eco +0 -1
- data/fixtures/sprockets-app2/source/javascripts/asset_path.js.erb +0 -3
- data/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb +0 -1
- data/fixtures/sprockets-app2/source/javascripts/sprockets_base.js +0 -5
- data/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js +0 -3
- data/fixtures/sprockets-app2/source/javascripts/templates.js +0 -1
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss +0 -1
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss +0 -1
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss +0 -1
- data/fixtures/sprockets-images-app/config.rb +0 -1
- data/fixtures/sprockets-images-app/source/index.html.erb +0 -10
- data/fixtures/sprockets-images-app/source/library/images/cat.jpg +0 -0
- data/fixtures/sprockets-images-app/vendor/assets/images/cat-2.jpg +0 -0
- data/fixtures/sprockets-imported-asset-path-conflicts-app/config.rb +0 -4
- data/fixtures/sprockets-imported-asset-path-conflicts-app/resources/assets/stylesheets/test.css +0 -3
- data/fixtures/sprockets-imported-assets-match-multiple-paths-app/config.rb +0 -4
- data/fixtures/sprockets-multiple-extensions-app/bower.json +0 -8
- data/fixtures/sprockets-multiple-extensions-app/config.rb +0 -1
- data/fixtures/sprockets-multiple-extensions-app/source/fonts/fontawesome-webfont-source.svg.gz +0 -0
- data/fixtures/sprockets-multiple-extensions-app/source/images/drawing-source.svg +0 -76
- data/fixtures/sprockets-multiple-extensions-app/source/stylesheets/app.css.scss +0 -3
- data/fixtures/sprockets-multiple-extensions-app/vendor/assets/components/font-awesome/fonts/fontawesome-webfont-bower.svg.gz +0 -0
- data/fixtures/sprockets-multiple-extensions-app/vendor/assets/components/jquery/jquery.asdf.asdf.js.min.asdf +0 -4
- data/fixtures/sprockets-multiple-extensions-app/vendor/assets/components/jquery/jquery.min.js +0 -4
- data/fixtures/sprockets-svg-font-app/bower.json +0 -8
- data/fixtures/sprockets-svg-font-app/config.rb +0 -1
- data/fixtures/sprockets-svg-font-app/source/fonts/fontawesome-webfont-source.svg +0 -504
- data/fixtures/sprockets-svg-font-app/source/fonts/fontawesome-webfont-source.svg.gz +0 -0
- data/fixtures/sprockets-svg-font-app/source/images/drawing-source.svg +0 -76
- data/fixtures/sprockets-svg-font-app/source/stylesheets/app.css.scss +0 -4
- data/fixtures/sprockets-svg-font-app/vendor/assets/components/blub/images/drawing-bower.svg +0 -76
- data/fixtures/sprockets-svg-font-app/vendor/assets/components/font-awesome/fonts/fontawesome-webfont-bower.svg +0 -504
- data/fixtures/sprockets-svg-font-app/vendor/assets/components/font-awesome/fonts/fontawesome-webfont-bower.svg.gz +0 -0
- data/fixtures/sprockets-svg-font-app/vendor/assets/components/font-awesome/fonts/fontawesome-webfont-bower.ttf.gz +0 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Long Filenames
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :sprockets
|
8
|
+
"""
|
9
|
+
And a file named "source/images/00000000-0000-0000-0000-000000.svg" with:
|
10
|
+
"""
|
11
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xlink="http://www.w3.org/1999/xlink" width="300" height="300">
|
12
|
+
<rect width="100" height="100" fill="#f06"></rect>
|
13
|
+
</svg>
|
14
|
+
"""
|
15
|
+
And a file named "source/images/00000000-0000-0000-0000-0000001.svg" with:
|
16
|
+
"""
|
17
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xlink="http://www.w3.org/1999/xlink" width="300" height="300">
|
18
|
+
<rect width="100" height="100" fill="#f06"></rect>
|
19
|
+
</svg>
|
20
|
+
"""
|
21
|
+
|
22
|
+
Scenario: Checking built folder for content
|
23
|
+
Given a successfully built app
|
24
|
+
|
25
|
+
When I cd to "build"
|
26
|
+
Then the following files should exist:
|
27
|
+
| images/00000000-0000-0000-0000-000000.svg |
|
28
|
+
| images/00000000-0000-0000-0000-0000001.svg |
|
29
|
+
And the file "images/00000000-0000-0000-0000-000000.svg" should contain "<svg xmlns"
|
30
|
+
And the file "images/00000000-0000-0000-0000-0000001.svg" should contain "<svg xmlns"
|
31
|
+
|
32
|
+
|
33
|
+
Scenario: Rendering html
|
34
|
+
Given the Server is running
|
35
|
+
|
36
|
+
When I go to "/images/00000000-0000-0000-0000-000000.svg"
|
37
|
+
Then I should see "<svg xmlns"
|
38
|
+
|
39
|
+
When I go to "/images/00000000-0000-0000-0000-0000001.svg"
|
40
|
+
Then I should see "<svg xmlns"
|
@@ -0,0 +1,106 @@
|
|
1
|
+
Feature: Link helpers work in Sprockets & Middleman for sprockets or middleman assets
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :sprockets do |c|
|
8
|
+
c.imported_asset_path = "sprockets"
|
9
|
+
end
|
10
|
+
"""
|
11
|
+
And a file named "vendor/js/one.js" with:
|
12
|
+
"""
|
13
|
+
console.log('one')
|
14
|
+
"""
|
15
|
+
And a file named "vendor/js/two.js.coffee" with:
|
16
|
+
"""
|
17
|
+
console.log('two')
|
18
|
+
"""
|
19
|
+
And a file named "vendor/js/three.js.erb" with:
|
20
|
+
"""
|
21
|
+
console.log('three')
|
22
|
+
"""
|
23
|
+
And a file named "vendor/js/four.js.coffee.erb" with:
|
24
|
+
"""
|
25
|
+
console.log('four')
|
26
|
+
"""
|
27
|
+
And a file named "vendor/css/one.css" with:
|
28
|
+
"""
|
29
|
+
.one { color: inherit; }
|
30
|
+
"""
|
31
|
+
And a file named "vendor/css/two.css.sass" with:
|
32
|
+
"""
|
33
|
+
.two
|
34
|
+
color: inherit
|
35
|
+
"""
|
36
|
+
And a file named "vendor/css/three.css.scss" with:
|
37
|
+
"""
|
38
|
+
.three { color: inherit; }
|
39
|
+
"""
|
40
|
+
And a file named "vendor/css/four.css.erb" with:
|
41
|
+
"""
|
42
|
+
.four { color: inherit; }
|
43
|
+
"""
|
44
|
+
And a file named "vendor/css/five.css.sass.erb" with:
|
45
|
+
"""
|
46
|
+
.five
|
47
|
+
color: inherit
|
48
|
+
"""
|
49
|
+
And a file named "vendor/css/six.css.scss.erb" with:
|
50
|
+
"""
|
51
|
+
.six { color: inherit; }
|
52
|
+
"""
|
53
|
+
|
54
|
+
And a file named "source/links.html.erb" with:
|
55
|
+
"""
|
56
|
+
<h2>JS Links</h2>
|
57
|
+
one: "<%= javascript_path('one') %>"
|
58
|
+
two: "<%= javascript_path('two') %>"
|
59
|
+
three: "<%= javascript_path('three') %>"
|
60
|
+
four: "<%= javascript_path('four') %>"
|
61
|
+
|
62
|
+
<h2>CSS Links</h2>
|
63
|
+
one: "<%= stylesheet_path('one') %>"
|
64
|
+
two: "<%= stylesheet_path('two') %>"
|
65
|
+
three: "<%= stylesheet_path('three') %>"
|
66
|
+
four: "<%= stylesheet_path('four') %>"
|
67
|
+
five: "<%= stylesheet_path('five') %>"
|
68
|
+
six: "<%= stylesheet_path('six') %>"
|
69
|
+
"""
|
70
|
+
|
71
|
+
|
72
|
+
Scenario: Link helpers work in a sprockets asset
|
73
|
+
Given a file named "source/javascripts/links.js.erb" with:
|
74
|
+
"""
|
75
|
+
var js_links = {
|
76
|
+
one: "<%= javascript_path('one') %>",
|
77
|
+
two: "<%= javascript_path('two') %>",
|
78
|
+
three: "<%= javascript_path('three') %>",
|
79
|
+
four: "<%= javascript_path('four') %>",
|
80
|
+
}
|
81
|
+
|
82
|
+
var css_links = {
|
83
|
+
one: "<%= stylesheet_path('one') %>",
|
84
|
+
two: "<%= stylesheet_path('two') %>",
|
85
|
+
three: "<%= stylesheet_path('three') %>",
|
86
|
+
four: "<%= stylesheet_path('four') %>",
|
87
|
+
five: "<%= stylesheet_path('five') %>",
|
88
|
+
six: "<%= stylesheet_path('six') %>"
|
89
|
+
}
|
90
|
+
"""
|
91
|
+
And the Server is running
|
92
|
+
|
93
|
+
When I go to "/javascripts/links.js"
|
94
|
+
Then I should see 'one: "/sprockets/one.js'
|
95
|
+
And I should see 'two: "/sprockets/two.js'
|
96
|
+
And I should see 'three: "/sprockets/three.js'
|
97
|
+
And I should see 'four: "/sprockets/four.js'
|
98
|
+
And I should see 'one: "/sprockets/one.css'
|
99
|
+
And I should see 'two: "/sprockets/two.css'
|
100
|
+
And I should see 'three: "/sprockets/three.css'
|
101
|
+
And I should see 'four: "/sprockets/four.css'
|
102
|
+
And I should see 'five: "/sprockets/five.css'
|
103
|
+
And I should see 'six: "/sprockets/six.css'
|
104
|
+
|
105
|
+
|
106
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: Processible assets outside js_dir or css_dir still compile
|
2
|
+
|
3
|
+
Scenario: Can process css & js outside the js_dir or css_dir
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :sprockets
|
8
|
+
"""
|
9
|
+
And a file named "source/root.js.coffee" with:
|
10
|
+
"""
|
11
|
+
console.log 'root'
|
12
|
+
"""
|
13
|
+
And a file named "source/dir/nested.js.coffee" with:
|
14
|
+
"""
|
15
|
+
console.log 'nested'
|
16
|
+
"""
|
17
|
+
And a file named "source/root.css.scss" with:
|
18
|
+
"""
|
19
|
+
body {
|
20
|
+
content: 'root';
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
And a file named "source/dir/nested.css.scss" with:
|
24
|
+
"""
|
25
|
+
body {
|
26
|
+
content: 'nested';
|
27
|
+
}
|
28
|
+
"""
|
29
|
+
And the Server is running
|
30
|
+
|
31
|
+
When I go to "/root.js"
|
32
|
+
Then I should see "console.log('root');"
|
33
|
+
|
34
|
+
When I go to "/dir/nested.js"
|
35
|
+
Then I should see "console.log('nested');"
|
36
|
+
|
37
|
+
When I go to "/root.css"
|
38
|
+
Then I should see:
|
39
|
+
"""
|
40
|
+
body {
|
41
|
+
content: 'root'; }
|
42
|
+
"""
|
43
|
+
|
44
|
+
When I go to "/dir/nested.css"
|
45
|
+
Then I should see:
|
46
|
+
"""
|
47
|
+
body {
|
48
|
+
content: 'nested'; }
|
49
|
+
"""
|
@@ -0,0 +1,76 @@
|
|
1
|
+
Feature: Sass should glob partials like sass-rails
|
2
|
+
Including the `sass-globbing` gem ins required for sass globs to work.
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given a fixture app "base-app"
|
6
|
+
And a file named "config.rb" with:
|
7
|
+
"""
|
8
|
+
require 'sass-globbing'
|
9
|
+
activate :sprockets
|
10
|
+
"""
|
11
|
+
And a file named "source/stylesheets/main.css.scss" with:
|
12
|
+
"""
|
13
|
+
@import "**/*";
|
14
|
+
"""
|
15
|
+
And a file named "source/stylesheets/d1/_s1.scss" with:
|
16
|
+
"""
|
17
|
+
.d1s1 { content: 'd1'; }
|
18
|
+
"""
|
19
|
+
And a file named "source/stylesheets/d2/_s1.sass" with:
|
20
|
+
"""
|
21
|
+
.d2s1
|
22
|
+
content: 'd2'
|
23
|
+
"""
|
24
|
+
And a file named "source/stylesheets/d2/d3/_s1.sass" with:
|
25
|
+
"""
|
26
|
+
.d3s1
|
27
|
+
content: 'd3'
|
28
|
+
"""
|
29
|
+
And a file named "source/stylesheets/d2/d3/_s2.scss" with:
|
30
|
+
"""
|
31
|
+
.d3s2 { content: 'd3'; }
|
32
|
+
"""
|
33
|
+
|
34
|
+
@sprockets3
|
35
|
+
Scenario: Sass globbing should work
|
36
|
+
Given the Server is running
|
37
|
+
When I go to "/stylesheets/main.css"
|
38
|
+
Then I should see ".d1s1"
|
39
|
+
And I should see ".d2s1"
|
40
|
+
And I should see ".d3s1"
|
41
|
+
And I should see ".d3s2"
|
42
|
+
|
43
|
+
@sprockets4
|
44
|
+
Scenario: Sass globbing should work
|
45
|
+
Sass globbing does not work with SassC, but does still work with Sprockets 4 if using ruby Sass.
|
46
|
+
|
47
|
+
Given a file named "config.rb" with:
|
48
|
+
"""
|
49
|
+
Object.send :remove_const, :SassC # simulate not having sassc
|
50
|
+
require 'sass-globbing'
|
51
|
+
activate :sprockets
|
52
|
+
"""
|
53
|
+
Given the Server is running
|
54
|
+
When I go to "/stylesheets/main.css"
|
55
|
+
Then I should see ".d1s1"
|
56
|
+
And I should see ".d2s1"
|
57
|
+
And I should see ".d3s1"
|
58
|
+
And I should see ".d3s2"
|
59
|
+
|
60
|
+
@sprockets3
|
61
|
+
Scenario: New files are spotted and imported
|
62
|
+
Because of how sass-globbing works, new or changed dependencies aren't spotted. You'll need to change/save the importing stylesheet for them to show up. Adding or removing a newline is a "cheap" trick to trigger the change.
|
63
|
+
|
64
|
+
Given the Server is running
|
65
|
+
And a file named "source/stylesheets/d2/_s2.scss" with:
|
66
|
+
"""
|
67
|
+
.d2s2 { content: 'd2s2'; }
|
68
|
+
"""
|
69
|
+
And the file "source/stylesheets/main.css.scss" content is changed to:
|
70
|
+
"""
|
71
|
+
@import "**/*";
|
72
|
+
|
73
|
+
"""
|
74
|
+
|
75
|
+
When I go to "/stylesheets/main.css"
|
76
|
+
Then I should see ".d2s2"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: Sass partials should work with Sprockets
|
2
|
+
Confirm that changing assets will be reflected in a files output, even if it is included as a partial.
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given a fixture app "base-app"
|
6
|
+
And a file named "config.rb" with:
|
7
|
+
"""
|
8
|
+
activate :sprockets
|
9
|
+
"""
|
10
|
+
And a file named "source/stylesheets/_partial.scss" with:
|
11
|
+
"""
|
12
|
+
body { color: red; }
|
13
|
+
"""
|
14
|
+
|
15
|
+
Scenario: The stylesheet shows updated content when Sprockets partials change
|
16
|
+
Given a file named "source/stylesheets/main.css.scss" with:
|
17
|
+
"""
|
18
|
+
@import "partial";
|
19
|
+
"""
|
20
|
+
And the Server is running
|
21
|
+
|
22
|
+
When I go to "/stylesheets/main.css"
|
23
|
+
Then I should see "color: red;"
|
24
|
+
|
25
|
+
And the file "source/stylesheets/_partial.scss" content is changed to:
|
26
|
+
"""
|
27
|
+
body { color: blue; }
|
28
|
+
"""
|
29
|
+
|
30
|
+
When I go to "/stylesheets/main.css"
|
31
|
+
Then I should see "color: blue;"
|
32
|
+
|
33
|
+
Scenario: The stylesheet shows updated content when an imported partial changes
|
34
|
+
Given a file named "source/stylesheets/main.css.scss" with:
|
35
|
+
"""
|
36
|
+
//= require _partial
|
37
|
+
"""
|
38
|
+
And the Server is running
|
39
|
+
|
40
|
+
When I go to "/stylesheets/main.css"
|
41
|
+
Then I should see "color: red;"
|
42
|
+
|
43
|
+
And the file "source/stylesheets/_partial.scss" content is changed to:
|
44
|
+
"""
|
45
|
+
body { color: blue; }
|
46
|
+
"""
|
47
|
+
|
48
|
+
When I go to "/stylesheets/main.css"
|
49
|
+
Then I should see "color: blue;"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Usage of SassC
|
2
|
+
|
3
|
+
Scenario: Using SassC
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
require "sassc"
|
8
|
+
activate :sprockets
|
9
|
+
"""
|
10
|
+
And a file named "source/stylesheets/site.css.scss" with:
|
11
|
+
"""
|
12
|
+
$color: #fff;
|
13
|
+
|
14
|
+
html {
|
15
|
+
body {
|
16
|
+
color: #fff;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
"""
|
20
|
+
And the Server is running
|
21
|
+
|
22
|
+
When I go to "/stylesheets/site.css"
|
23
|
+
Then I should see:
|
24
|
+
"""
|
25
|
+
html body {
|
26
|
+
color: #fff; }
|
27
|
+
"""
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Sprockets is available for use in templates
|
2
|
+
|
3
|
+
Scenario: Render a sprockets svg from a template
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :sprockets
|
8
|
+
sprockets.append_path "vendor/images"
|
9
|
+
"""
|
10
|
+
And a file named "vendor/images/logo.svg" with:
|
11
|
+
"""
|
12
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
13
|
+
"""
|
14
|
+
And a file named "source/index.html.erb" with:
|
15
|
+
"""
|
16
|
+
<%= sprockets['logo.svg'].source %>
|
17
|
+
"""
|
18
|
+
And the Server is running
|
19
|
+
|
20
|
+
When I go to "/"
|
21
|
+
Then I should see '<?xml version="1.0" encoding="iso-8859-1"?>'
|
@@ -0,0 +1,88 @@
|
|
1
|
+
Feature: Using assets gems assets
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a fixture app "base-app"
|
5
|
+
And a file named "config.rb" with:
|
6
|
+
"""
|
7
|
+
activate :sprockets
|
8
|
+
sprockets.append_path File.join(root, 'vendor')
|
9
|
+
"""
|
10
|
+
And a file named "source/javascripts/require_from_assets_gem.js" with:
|
11
|
+
"""
|
12
|
+
//= require _imports/import
|
13
|
+
"""
|
14
|
+
And a file named "source/stylesheets/require_from_assets_gem.css" with:
|
15
|
+
"""
|
16
|
+
//= require test
|
17
|
+
"""
|
18
|
+
And a file named "vendor/javascripts/vendor_import.js" with:
|
19
|
+
"""
|
20
|
+
console.log('vendor');
|
21
|
+
"""
|
22
|
+
And a file named "source/javascripts/require_from_vendor.js" with:
|
23
|
+
"""
|
24
|
+
//= require vendor_import
|
25
|
+
"""
|
26
|
+
And a file named "vendor/stylesheets/vendor_import.css" with:
|
27
|
+
"""
|
28
|
+
body { content: 'vendor'; }
|
29
|
+
"""
|
30
|
+
And a file named "source/stylesheets/require_from_vendor.css" with:
|
31
|
+
"""
|
32
|
+
//= require vendor_import
|
33
|
+
//= require with_img
|
34
|
+
"""
|
35
|
+
And a file named "vendor/stylesheets/with_img.css.scss" with:
|
36
|
+
"""
|
37
|
+
body { background: image-url('vendor_gem/logo.png'); }
|
38
|
+
"""
|
39
|
+
And a file named "vendor/images/vendor_gem/logo.png" with:
|
40
|
+
"""
|
41
|
+
"""
|
42
|
+
|
43
|
+
Scenario: Assets are requirable from a gem
|
44
|
+
Given the Server is running
|
45
|
+
|
46
|
+
When I go to "/javascripts/require_from_assets_gem.js"
|
47
|
+
Then I should see 'alert("imported");'
|
48
|
+
|
49
|
+
When I go to "/stylesheets/require_from_assets_gem.css"
|
50
|
+
Then I should see "background: #fd0;"
|
51
|
+
|
52
|
+
|
53
|
+
Scenario: Assets are requirable from a custom vendor dir
|
54
|
+
Given the Server is running
|
55
|
+
|
56
|
+
When I go to "/javascripts/require_from_vendor.js"
|
57
|
+
Then I should see "console.log('vendor');"
|
58
|
+
|
59
|
+
When I go to "/stylesheets/require_from_vendor.css"
|
60
|
+
Then I should see "content: 'vendor';"
|
61
|
+
|
62
|
+
Scenario: Gem images have correct path in preview
|
63
|
+
Given the Server is running
|
64
|
+
|
65
|
+
When I go to "/stylesheets/require_from_vendor.css"
|
66
|
+
Then I should see "url(/assets/images/vendor_gem/logo.png)"
|
67
|
+
|
68
|
+
|
69
|
+
Scenario: Gem images have correct path in build
|
70
|
+
Given a successfully built app
|
71
|
+
When I cd to "build"
|
72
|
+
Then the following files should exist:
|
73
|
+
| stylesheets/require_from_vendor.css |
|
74
|
+
| assets/images/vendor_gem/logo.png |
|
75
|
+
And the file "stylesheets/require_from_vendor.css" should contain 'url(/assets/images/vendor_gem/logo.png)'
|
76
|
+
|
77
|
+
Scenario: Gem images have correct paths when :relative_assets is activated
|
78
|
+
And a file named "config.rb" with:
|
79
|
+
"""
|
80
|
+
activate :sprockets
|
81
|
+
sprockets.append_path File.join(root, 'vendor')
|
82
|
+
|
83
|
+
activate :relative_assets
|
84
|
+
"""
|
85
|
+
And the Server is running
|
86
|
+
|
87
|
+
When I go to "/stylesheets/require_from_vendor.css"
|
88
|
+
Then I should see 'url(../assets/images/vendor_gem/logo.png)'
|