middleman-sprockets-cj 3.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.simplecov +9 -0
- data/.travis.yml +15 -0
- data/CHANGELOG.md +71 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +32 -0
- data/LICENSE.md +20 -0
- data/README.md +104 -0
- data/Rakefile +45 -0
- data/features/asset_hash-3.0.feature +105 -0
- data/features/asset_hash.feature +107 -0
- data/features/bower.feature +37 -0
- data/features/jst.feature +14 -0
- data/features/long_filenames.feature +17 -0
- data/features/sass_globs.feature +9 -0
- data/features/sass_partials.feature +36 -0
- data/features/sprockets.feature +129 -0
- data/features/sprockets_gems.feature +67 -0
- data/features/step_definitions/server_steps.rb +7 -0
- data/features/support/env.rb +18 -0
- data/fixtures/asset-hash-app/config.rb +7 -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/javascripts/sprockets_base.js +5 -0
- data/fixtures/asset-hash-app/source/javascripts/sprockets_sub.js +3 -0
- data/fixtures/asset-hash-app/source/layout.erb +19 -0
- data/fixtures/asset-hash-app/source/other.html.erb +2 -0
- data/fixtures/asset-hash-app/source/partials.html.erb +2 -0
- data/fixtures/asset-hash-app/source/stylesheets/_partial.sass +2 -0
- data/fixtures/asset-hash-app/source/stylesheets/jquery-mobile.css.scss +1 -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/asset-paths-app/config.rb +4 -0
- data/fixtures/asset-paths-app/derp/javascripts/vendored_js.js +1 -0
- data/fixtures/asset-paths-app/source/javascripts/vendored_include.js +1 -0
- data/fixtures/bower-app/bower.json +7 -0
- data/fixtures/bower-app/bower_components/underscore/bower.json +8 -0
- data/fixtures/bower-app/bower_components/underscore/underscore.js +1343 -0
- data/fixtures/bower-app/config.rb +3 -0
- data/fixtures/bower-app/source/javascripts/application.js +1 -0
- data/fixtures/bower-individual-outputdir-app/bower.json +7 -0
- data/fixtures/bower-individual-outputdir-app/bower_components/underscore/bower.json +8 -0
- data/fixtures/bower-individual-outputdir-app/bower_components/underscore/underscore.js +1343 -0
- data/fixtures/bower-individual-outputdir-app/config.rb +6 -0
- data/fixtures/bower-individual-outputdir-app/source/javascripts/application.js +1 -0
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/.bower.json +34 -0
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/bower.json +26 -0
- 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 +2 -0
- data/fixtures/bower-individual-outputdir-app/vendor/assets/components/lightbox2/package.json +37 -0
- data/fixtures/bower-json-app/config.rb +1 -0
- data/fixtures/bower-json-app/source/javascripts/application.js.coffee +1 -0
- data/fixtures/bower-json-app/source/javascripts/bower.json +5 -0
- data/fixtures/bower-multiple-assets-app/.bowerrc +4 -0
- data/fixtures/bower-multiple-assets-app/bower.json +7 -0
- data/fixtures/bower-multiple-assets-app/config.rb +7 -0
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/.bower.json +34 -0
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/bower.json +26 -0
- 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/js/lightbox.js +2 -0
- data/fixtures/bower-multiple-assets-app/vendor/assets/components/lightbox2/package.json +37 -0
- data/fixtures/glob-app/config.rb +0 -0
- data/fixtures/glob-app/source/stylesheets/main.css.scss +1 -0
- data/fixtures/glob-app/source/stylesheets/module1/_i-am-mod.scss +3 -0
- data/fixtures/glob-app/source/stylesheets/module2/_derp.sass +2 -0
- data/fixtures/glob-app/source/stylesheets/shared/3rd-party/bootstrap.sass +2 -0
- data/fixtures/glob-app/source/stylesheets/shared/shared.scss +3 -0
- data/fixtures/jquery-mobile-app/config.rb +0 -0
- data/fixtures/jquery-mobile-app/source/stylesheets/base.css.scss +2 -0
- data/fixtures/long-filenames-app/config.rb +0 -0
- data/fixtures/long-filenames-app/source/images/00000000-0000-0000-0000-000000.svg +3 -0
- data/fixtures/long-filenames-app/source/images/00000000-0000-0000-0000-0000001.svg +3 -0
- data/fixtures/preview-app/config.rb +0 -0
- data/fixtures/preview-app/source/content.html.erb +1 -0
- data/fixtures/preview-app/source/layout.erb +1 -0
- data/fixtures/preview-app/source/stylesheets/_partial.sass +2 -0
- data/fixtures/preview-app/source/stylesheets/_partial2.css.sass +2 -0
- data/fixtures/preview-app/source/stylesheets/main.css.sass +4 -0
- data/fixtures/preview-app/source/stylesheets/main2.css.sass +4 -0
- data/fixtures/preview-app/source/stylesheets/plain.css.sass +2 -0
- data/fixtures/sprockets-app-debug-assets/config.rb +1 -0
- data/fixtures/sprockets-app-debug-assets/source/index.html.erb +8 -0
- data/fixtures/sprockets-app-debug-assets/source/javascripts/dependency1.js +3 -0
- data/fixtures/sprockets-app-debug-assets/source/javascripts/dependency2.js +1 -0
- data/fixtures/sprockets-app-debug-assets/source/javascripts/main.js +4 -0
- data/fixtures/sprockets-app-debug-assets/source/stylesheets/app.css.scss +4 -0
- data/fixtures/sprockets-app-debug-assets/source/stylesheets/dependency1.css +0 -0
- data/fixtures/sprockets-app-debug-assets/source/stylesheets/dependency2.css.scss +0 -0
- data/fixtures/sprockets-app/config.rb +7 -0
- data/fixtures/sprockets-app/source/index.html.erb +6 -0
- data/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/plain.css +3 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/js/jquery_include.js +1 -0
- data/fixtures/sprockets-app/source/library/js/plain.js +3 -0
- data/fixtures/sprockets-app/source/library/js/sprockets_base.js +5 -0
- data/fixtures/sprockets-app/source/library/js/sprockets_sub.js +3 -0
- data/fixtures/sprockets-app/source/library/js/vendored_include.js +1 -0
- data/fixtures/sprockets-app/vendor/assets/javascripts/coffee.js.coffee +2 -0
- data/fixtures/sprockets-app/vendor/assets/javascripts/vendored_js.js +1 -0
- data/fixtures/sprockets-app/vendor/assets/stylesheets/vendored.css.scss +4 -0
- data/fixtures/sprockets-app2/config.rb +0 -0
- data/fixtures/sprockets-app2/data/test.yml +4 -0
- data/fixtures/sprockets-app2/data/test2.json +4 -0
- data/fixtures/sprockets-app2/source/javascripts/_templates/test.jst.ejs +1 -0
- data/fixtures/sprockets-app2/source/javascripts/_templates/test2.jst.eco +1 -0
- data/fixtures/sprockets-app2/source/javascripts/asset_path.js.erb +3 -0
- data/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb +1 -0
- data/fixtures/sprockets-app2/source/javascripts/sprockets_base.js +5 -0
- data/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js +3 -0
- data/fixtures/sprockets-app2/source/javascripts/templates.js +1 -0
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss +1 -0
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss +1 -0
- data/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss +1 -0
- data/fixtures/sprockets-images-app/config.rb +1 -0
- data/fixtures/sprockets-images-app/source/index.html.erb +10 -0
- 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/lib/middleman-sprockets.rb +6 -0
- data/lib/middleman-sprockets/asset.rb +185 -0
- data/lib/middleman-sprockets/asset_list.rb +41 -0
- data/lib/middleman-sprockets/asset_tag_helpers.rb +54 -0
- data/lib/middleman-sprockets/config_only_environment.rb +50 -0
- data/lib/middleman-sprockets/environment.rb +228 -0
- data/lib/middleman-sprockets/extension.rb +145 -0
- data/lib/middleman-sprockets/imported_asset.rb +57 -0
- data/lib/middleman-sprockets/pathname_extensions.rb +10 -0
- data/lib/middleman-sprockets/sass_function_hack.rb +9 -0
- data/lib/middleman-sprockets/version.rb +5 -0
- data/middleman-sprockets.gemspec +22 -0
- data/spec/asset_list_spec.rb +38 -0
- data/spec/asset_spec.rb +116 -0
- data/spec/imported_asset_spec.rb +72 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/aruba.rb +18 -0
- data/spec/support/rspec.rb +17 -0
- metadata +257 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
@new
|
2
|
+
Feature: Assets get a file hash appended to their URL and references to them are updated
|
3
|
+
Scenario: Hashed-asset files are produced, and HTML, CSS, and JavaScript gets rewritten to reference the new files
|
4
|
+
Given a successfully built app at "asset-hash-app"
|
5
|
+
When I cd to "build"
|
6
|
+
Then the following files should exist:
|
7
|
+
| index.html |
|
8
|
+
| images/100px-1242c368.png |
|
9
|
+
| images/100px-5fd6fb90.jpg |
|
10
|
+
| images/100px-5fd6fb90.gif |
|
11
|
+
| javascripts/application-df677242.js |
|
12
|
+
| stylesheets/site-b7f4d02f.css |
|
13
|
+
| index.html |
|
14
|
+
| subdir/index.html |
|
15
|
+
| other/index.html |
|
16
|
+
And the following files should not exist:
|
17
|
+
| images/100px.png |
|
18
|
+
| images/100px.jpg |
|
19
|
+
| images/100px.gif |
|
20
|
+
| javascripts/application.js |
|
21
|
+
| stylesheets/site.css |
|
22
|
+
|
23
|
+
And the file "javascripts/application-df677242.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'"
|
24
|
+
And the file "stylesheets/site-b7f4d02f.css" should contain 'background-image: url("../images/100px-5fd6fb90.jpg")'
|
25
|
+
And the file "index.html" should contain 'href="stylesheets/site-b7f4d02f.css"'
|
26
|
+
And the file "index.html" should contain 'src="javascripts/application-df677242.js"'
|
27
|
+
And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"'
|
28
|
+
And the file "subdir/index.html" should contain 'href="../stylesheets/site-b7f4d02f.css"'
|
29
|
+
And the file "subdir/index.html" should contain 'src="../javascripts/application-df677242.js"'
|
30
|
+
And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
|
31
|
+
And the file "other/index.html" should contain 'href="../stylesheets/site-b7f4d02f.css"'
|
32
|
+
And the file "other/index.html" should contain 'src="../javascripts/application-df677242.js"'
|
33
|
+
And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"'
|
34
|
+
|
35
|
+
Scenario: Hashed assets work in preview server
|
36
|
+
Given the Server is running at "asset-hash-app"
|
37
|
+
When I go to "/"
|
38
|
+
Then I should see 'href="stylesheets/site-b7f4d02f.css"'
|
39
|
+
Then I should see 'href="stylesheets/jquery-mobile-05f64032.css"'
|
40
|
+
And I should see 'src="javascripts/application-df677242.js"'
|
41
|
+
And I should see 'src="images/100px-5fd6fb90.jpg"'
|
42
|
+
When I go to "/subdir/"
|
43
|
+
Then I should see 'href="../stylesheets/site-b7f4d02f.css"'
|
44
|
+
And I should see 'src="../javascripts/application-df677242.js"'
|
45
|
+
And I should see 'src="../images/100px-5fd6fb90.jpg"'
|
46
|
+
When I go to "/other/"
|
47
|
+
Then I should see 'href="../stylesheets/site-b7f4d02f.css"'
|
48
|
+
And I should see 'src="../javascripts/application-df677242.js"'
|
49
|
+
And I should see 'src="../images/100px-5fd6fb90.jpg"'
|
50
|
+
When I go to "/javascripts/application-df677242.js"
|
51
|
+
Then I should see "img.src = '/images/100px-5fd6fb90.jpg'"
|
52
|
+
When I go to "/stylesheets/site-b7f4d02f.css"
|
53
|
+
Then I should see 'background-image: url("../images/100px-5fd6fb90.jpg")'
|
54
|
+
When I go to "/stylesheets/jquery-mobile-05f64032.css"
|
55
|
+
Then I should see 'background-image: url("../images/jquery-mobile/icons-18-white-1681b2cc.png")'
|
56
|
+
|
57
|
+
Scenario: Enabling an asset host still produces hashed files and references
|
58
|
+
Given the Server is running at "asset-hash-host-app"
|
59
|
+
When I go to "/"
|
60
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-1fdf4fb5.css"'
|
61
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
62
|
+
When I go to "/subdir/"
|
63
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-1fdf4fb5.css"'
|
64
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
65
|
+
When I go to "/other/"
|
66
|
+
Then I should see 'href="http://middlemanapp.com/stylesheets/site-1fdf4fb5.css"'
|
67
|
+
And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"'
|
68
|
+
When I go to "/stylesheets/site-1fdf4fb5.css"
|
69
|
+
Then I should see 'background-image: url("http://middlemanapp.com/images/100px-5fd6fb90.jpg")'
|
70
|
+
|
71
|
+
Scenario: The asset hash should change when a SASS partial changes
|
72
|
+
Given the Server is running at "asset-hash-app"
|
73
|
+
And the file "source/stylesheets/_partial.sass" has the contents
|
74
|
+
"""
|
75
|
+
body
|
76
|
+
font-size: 14px
|
77
|
+
"""
|
78
|
+
When I go to "/partials/"
|
79
|
+
Then I should see 'href="../stylesheets/uses_partials-a48be509.css'
|
80
|
+
And wait a second
|
81
|
+
And the file "source/stylesheets/_partial.sass" has the contents
|
82
|
+
"""
|
83
|
+
body
|
84
|
+
font-size: 18px !important
|
85
|
+
"""
|
86
|
+
When I go to "/partials/"
|
87
|
+
Then I should see 'href="../stylesheets/uses_partials-e8c3d4eb.css'
|
88
|
+
|
89
|
+
Scenario: The asset hash should change when a Javascript partial changes
|
90
|
+
Given the Server is running at "asset-hash-app"
|
91
|
+
And the file "source/javascripts/sprockets_sub.js" has the contents
|
92
|
+
"""
|
93
|
+
function sprockets_sub_function() { }
|
94
|
+
"""
|
95
|
+
When I go to "/partials/"
|
96
|
+
Then I should see 'src="../javascripts/sprockets_base-0252a861.js'
|
97
|
+
When I go to "/javascripts/sprockets_base-0252a861.js"
|
98
|
+
Then I should see "sprockets_sub_function"
|
99
|
+
And wait a second
|
100
|
+
And the file "source/javascripts/sprockets_sub.js" has the contents
|
101
|
+
"""
|
102
|
+
function sprockets_sub2_function() { }
|
103
|
+
"""
|
104
|
+
When I go to "/partials/"
|
105
|
+
Then I should see 'src="../javascripts/sprockets_base-5121d891.js'
|
106
|
+
When I go to "/javascripts/sprockets_base-5121d891.js"
|
107
|
+
Then I should see "sprockets_sub2_function"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Feature: Bower
|
2
|
+
Scenario: Sprockets can pull underscore from bower
|
3
|
+
Given the Server is running at "bower-app"
|
4
|
+
When I go to "/javascripts/application.js"
|
5
|
+
Then I should see "return _;"
|
6
|
+
|
7
|
+
Scenario: Sprockets can build underscore from bower
|
8
|
+
Given a successfully built app at "bower-app"
|
9
|
+
When I cd to "build"
|
10
|
+
Then the following files should exist:
|
11
|
+
| javascripts/application.js |
|
12
|
+
And the file "javascripts/application.js" should contain "return _;"
|
13
|
+
|
14
|
+
Scenario: Sprockets should not mess with bower.json
|
15
|
+
Given a successfully built app at "bower-json-app"
|
16
|
+
When I cd to "build"
|
17
|
+
Then the following files should exist:
|
18
|
+
| javascripts/bower.json |
|
19
|
+
And the file "javascripts/bower.json" should contain '"name": "my-project",'
|
20
|
+
|
21
|
+
Scenario: Assets can be added to the build with import_asset from bower dir
|
22
|
+
Given a successfully built app at "bower-app"
|
23
|
+
When I cd to "build"
|
24
|
+
Then a file named "javascripts/underscore/underscore.js" should exist
|
25
|
+
|
26
|
+
Scenario: Multiple assets can be added to the build with import_asset from bower dir and are placed in the correct directory
|
27
|
+
Given a successfully built app at "bower-multiple-assets-app"
|
28
|
+
When I cd to "build"
|
29
|
+
Then a file named "images/lightbox2/img/close.png" should exist
|
30
|
+
Then a file named "javascripts/lightbox2/js/lightbox.js" should exist
|
31
|
+
|
32
|
+
Scenario: Assets can have an individual output directory
|
33
|
+
Given a successfully built app at "bower-individual-outputdir-app"
|
34
|
+
When I cd to "build"
|
35
|
+
Then a file named "underscore.js" should exist
|
36
|
+
And a file named "hello_world/lightbox2/img/close.png" should exist
|
37
|
+
And a file named "javascripts/lightbox2/js/lightbox.js" should exist
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Sprockets JST
|
2
|
+
|
3
|
+
Scenario: EJS
|
4
|
+
Given the Server is running at "sprockets-app2"
|
5
|
+
When I go to "/javascripts/templates.js"
|
6
|
+
Then I should see '["_templates/test"] = function'
|
7
|
+
And I should see '["_templates/test2"] = function'
|
8
|
+
|
9
|
+
Scenario: Multiple engine files should build correctly
|
10
|
+
Given a successfully built app at "sprockets-app2"
|
11
|
+
When I cd to "build"
|
12
|
+
Then a file named "javascripts/templates.js" should exist
|
13
|
+
And the file "javascripts/templates.js" should contain '["_templates/test"] = function'
|
14
|
+
And the file "javascripts/templates.js" should contain '["_templates/test2"] = function'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Feature: Long Filenames
|
2
|
+
|
3
|
+
Scenario: Checking built folder for content
|
4
|
+
Given a successfully built app at "long-filenames-app"
|
5
|
+
When I cd to "build"
|
6
|
+
Then the following files should exist:
|
7
|
+
| images/00000000-0000-0000-0000-000000.svg |
|
8
|
+
| images/00000000-0000-0000-0000-0000001.svg |
|
9
|
+
And the file "images/00000000-0000-0000-0000-000000.svg" should contain "<svg xmlns"
|
10
|
+
And the file "images/00000000-0000-0000-0000-0000001.svg" should contain "<svg xmlns"
|
11
|
+
|
12
|
+
Scenario: Rendering html
|
13
|
+
Given the Server is running at "long-filenames-app"
|
14
|
+
When I go to "/images/00000000-0000-0000-0000-000000.svg"
|
15
|
+
Then I should see "<svg xmlns"
|
16
|
+
When I go to "/images/00000000-0000-0000-0000-0000001.svg"
|
17
|
+
Then I should see "<svg xmlns"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Feature: Sass should glob partials like sass-rails
|
2
|
+
|
3
|
+
Scenario: Sass globbing should work
|
4
|
+
Given the Server is running at "glob-app"
|
5
|
+
When I go to "/stylesheets/main.css"
|
6
|
+
Then I should see "module1"
|
7
|
+
And I should see "module2"
|
8
|
+
And I should see "shared-root"
|
9
|
+
And I should see "bootstrap"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Feature: Sass partials should work with Sprockets
|
2
|
+
|
3
|
+
Scenario: The preview server should update stylesheets when Sprockets partials change
|
4
|
+
Given the Server is running at "preview-app"
|
5
|
+
And the file "source/stylesheets/main2.css.sass" has the contents
|
6
|
+
"""
|
7
|
+
//= require "_partial2.css.sass"
|
8
|
+
|
9
|
+
red
|
10
|
+
color: red
|
11
|
+
"""
|
12
|
+
And the file "source/stylesheets/_partial2.css.sass" has the contents
|
13
|
+
"""
|
14
|
+
body
|
15
|
+
font-size: 14px
|
16
|
+
"""
|
17
|
+
When I go to "/stylesheets/main2.css"
|
18
|
+
Then I should see "color: red;"
|
19
|
+
Then I should see "font-size: 14px"
|
20
|
+
And wait a second
|
21
|
+
And the file "source/stylesheets/main2.css.sass" has the contents
|
22
|
+
"""
|
23
|
+
//= require "_partial2.css.sass"
|
24
|
+
|
25
|
+
red
|
26
|
+
color: blue
|
27
|
+
"""
|
28
|
+
And the file "source/stylesheets/_partial2.css.sass" has the contents
|
29
|
+
"""
|
30
|
+
body
|
31
|
+
font-size: 18px
|
32
|
+
"""
|
33
|
+
When I go to "/stylesheets/main2.css"
|
34
|
+
When I go to "/stylesheets/main2.css"
|
35
|
+
Then I should see "color: blue;"
|
36
|
+
Then I should see "font-size: 18px"
|
@@ -0,0 +1,129 @@
|
|
1
|
+
Feature: Sprockets
|
2
|
+
|
3
|
+
Scenario: Sprockets JS require
|
4
|
+
Given the Server is running at "sprockets-app2"
|
5
|
+
When I go to "/javascripts/sprockets_base.js"
|
6
|
+
Then I should see "sprockets_sub_function"
|
7
|
+
|
8
|
+
Scenario: javascript_include_tag with opts
|
9
|
+
Given the Server is running at "sprockets-app"
|
10
|
+
When I go to "/index.html"
|
11
|
+
Then I should see "data-name"
|
12
|
+
|
13
|
+
Scenario: asset_path helper
|
14
|
+
Given the Server is running at "sprockets-app2"
|
15
|
+
When I go to "/javascripts/asset_path.js"
|
16
|
+
Then I should see "templates.js"
|
17
|
+
|
18
|
+
Scenario: Sprockets JS require with custom :js_dir
|
19
|
+
Given the Server is running at "sprockets-app"
|
20
|
+
When I go to "/library/js/sprockets_base.js"
|
21
|
+
Then I should see "sprockets_sub_function"
|
22
|
+
|
23
|
+
Scenario: Plain JS require with custom :js_dir
|
24
|
+
Given the Server is running at "sprockets-app"
|
25
|
+
When I go to "/library/css/plain.css"
|
26
|
+
Then I should see "helloWorld"
|
27
|
+
|
28
|
+
Scenario: Sprockets JS should have access to yaml data
|
29
|
+
Given the Server is running at "sprockets-app2"
|
30
|
+
When I go to "/javascripts/multiple_engines.js"
|
31
|
+
Then I should see "Hello One"
|
32
|
+
|
33
|
+
Scenario: Sprockets JS should only contain body when requested
|
34
|
+
Given the Server is running at "sprockets-app2"
|
35
|
+
When I go to "/javascripts/sprockets_base.js?body=1"
|
36
|
+
Then I should see "base"
|
37
|
+
And I should not see "sprockets_sub_function"
|
38
|
+
|
39
|
+
Scenario: Script tags should be provided individually while debugging assets
|
40
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
41
|
+
When I go to "/index.html"
|
42
|
+
Then I should see "data-name"
|
43
|
+
Then I should see 'src="/javascripts/dependency2.js?body=1"'
|
44
|
+
Then I should see 'src="/javascripts/dependency1.js?body=1"'
|
45
|
+
Then I should see 'src="/javascripts/main.js?body=1"'
|
46
|
+
|
47
|
+
Scenario: External script tags should not be changed
|
48
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
49
|
+
When I go to "/index.html"
|
50
|
+
Then I should see 'src="//domain.com/script.js"'
|
51
|
+
Then I should see 'src="http://domain.com/script.js"'
|
52
|
+
Then I should see 'src="https://domain.com/script.js"'
|
53
|
+
|
54
|
+
Scenario: Sprockets CSS should only contain body when requested
|
55
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
56
|
+
When I go to "/stylesheets/app.css?body=1"
|
57
|
+
Then I should see "body"
|
58
|
+
|
59
|
+
Scenario: Stylesheets tags should be provided individually while debugging assets
|
60
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
61
|
+
When I go to "/index.html"
|
62
|
+
Then I should see 'href="/stylesheets/app.css?body=1"'
|
63
|
+
Then I should see 'href="/stylesheets/dependency1.css?body=1"'
|
64
|
+
Then I should see 'href="/stylesheets/dependency2.css?body=1"'
|
65
|
+
|
66
|
+
Scenario: External stylesheet tags should not be changed
|
67
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
68
|
+
When I go to "/index.html"
|
69
|
+
Then I should see 'href="//domain.com/styles.css"'
|
70
|
+
Then I should see 'href="http://domain.com/styles.css"'
|
71
|
+
Then I should see 'href="https://domain.com/styles.css"'
|
72
|
+
|
73
|
+
Scenario: Multiple engine files should build correctly
|
74
|
+
Given a successfully built app at "sprockets-app2"
|
75
|
+
When I cd to "build"
|
76
|
+
Then a file named "javascripts/multiple_engines.js" should exist
|
77
|
+
And the file "javascripts/multiple_engines.js" should contain "Hello One"
|
78
|
+
|
79
|
+
Scenario: Sprockets CSS require //require
|
80
|
+
Given the Server is running at "sprockets-app2"
|
81
|
+
When I go to "/stylesheets/sprockets_base1.css"
|
82
|
+
Then I should see "hello"
|
83
|
+
|
84
|
+
Scenario: Sprockets CSS require @import
|
85
|
+
Given the Server is running at "sprockets-app2"
|
86
|
+
When I go to "/stylesheets/sprockets_base2.css"
|
87
|
+
Then I should see "hello"
|
88
|
+
|
89
|
+
Scenario: Sprockets CSS require with custom :css_dir //require
|
90
|
+
Given the Server is running at "sprockets-app"
|
91
|
+
When I go to "/library/css/sprockets_base1.css"
|
92
|
+
Then I should see "hello"
|
93
|
+
|
94
|
+
Scenario: Plain CSS require with custom :css_dir
|
95
|
+
Given the Server is running at "sprockets-app"
|
96
|
+
When I go to "/library/css/plain.css"
|
97
|
+
Then I should see "helloWorld"
|
98
|
+
|
99
|
+
Scenario: Sprockets CSS require with custom :css_dir @import
|
100
|
+
Given the Server is running at "sprockets-app"
|
101
|
+
When I go to "/library/css/sprockets_base2.css"
|
102
|
+
Then I should see "hello"
|
103
|
+
|
104
|
+
Scenario: Sprockets inline Images with asset_path and image_path helpers
|
105
|
+
Given the Server is running at "sprockets-images-app"
|
106
|
+
When I go to "/"
|
107
|
+
Then I should see 'src="/library/images/cat.jpg"'
|
108
|
+
And I should see 'src="/library/images/cat-2.jpg"'
|
109
|
+
When I go to "/library/images/cat.jpg"
|
110
|
+
Then I should get a response with status "200"
|
111
|
+
When I go to "/library/images/cat-2.jpg"
|
112
|
+
Then I should get a response with status "200"
|
113
|
+
|
114
|
+
Scenario: Assets built through import_asset are built with the right extension
|
115
|
+
Given a successfully built app at "sprockets-app"
|
116
|
+
When I cd to "build"
|
117
|
+
# source file is /library/css/vendored.css.scss
|
118
|
+
Then a file named "library/css/vendored.css" should exist
|
119
|
+
# source file is /library/css/coffee.js.coffee
|
120
|
+
Then a file named "library/js/coffee.js" should exist
|
121
|
+
|
122
|
+
Scenario: Vendor assets get right extension
|
123
|
+
Given the Server is running at "sprockets-app"
|
124
|
+
# source file is /library/css/vendored.css.scss
|
125
|
+
When I go to "/library/css/vendored.css"
|
126
|
+
And I should see 'background: brown;'
|
127
|
+
# source file is /library/js/coffee.js.coffee
|
128
|
+
When I go to "/library/js/coffee.js"
|
129
|
+
And I should see 'return console.log("bar");'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
Feature: Sprockets Gems
|
2
|
+
Scenario: Sprockets can pull jQuery from gem
|
3
|
+
Given the Server is running at "sprockets-app"
|
4
|
+
When I go to "/library/js/jquery_include.js"
|
5
|
+
Then I should see "window.jQuery ="
|
6
|
+
|
7
|
+
Scenario: Sprockets can pull CSS from gem
|
8
|
+
Given the Server is running at "sprockets-app"
|
9
|
+
When I go to "/library/css/bootstrap_include.css"
|
10
|
+
Then I should see ".btn-default"
|
11
|
+
|
12
|
+
Scenario: Sprockets can pull js from vendored assets
|
13
|
+
Given the Server is running at "sprockets-app"
|
14
|
+
When I go to "/library/js/vendored_include.js"
|
15
|
+
Then I should see "var vendored_js_included = true;"
|
16
|
+
|
17
|
+
Scenario: Sprockets can pull js from custom vendor dir
|
18
|
+
Given the Server is running at "asset-paths-app"
|
19
|
+
When I go to "/javascripts/vendored_include.js"
|
20
|
+
Then I should see "var vendored_js_included = true;"
|
21
|
+
|
22
|
+
Scenario: Proper reference to images from a gem, in preview
|
23
|
+
Given the Server is running at "jquery-mobile-app"
|
24
|
+
When I go to "/stylesheets/base.css"
|
25
|
+
Then I should see 'url("/images/jquery-mobile/ajax-loader.gif")'
|
26
|
+
|
27
|
+
Scenario: Proper reference to images from a gem, in build
|
28
|
+
Given a successfully built app at "jquery-mobile-app"
|
29
|
+
When I cd to "build"
|
30
|
+
Then the following files should exist:
|
31
|
+
| stylesheets/base.css |
|
32
|
+
| images/jquery-mobile/ajax-loader.gif |
|
33
|
+
And the file "stylesheets/base.css" should contain 'url("/images/jquery-mobile/ajax-loader.gif")'
|
34
|
+
|
35
|
+
Scenario: Same thing, but with :relative_assets on
|
36
|
+
Given a fixture app "jquery-mobile-app"
|
37
|
+
And a file named "config.rb" with:
|
38
|
+
"""
|
39
|
+
activate :relative_assets
|
40
|
+
"""
|
41
|
+
Given the Server is running at "jquery-mobile-app"
|
42
|
+
When I go to "/stylesheets/base.css"
|
43
|
+
Then I should see 'url("../images/jquery-mobile/ajax-loader.gif")'
|
44
|
+
|
45
|
+
Scenario: JS/CSS from gems aren't aumatically in the site
|
46
|
+
Given the Server is running at "jquery-mobile-app"
|
47
|
+
When I go to "/javascripts/jquery.mobile.js"
|
48
|
+
Then I should get a response with status "404"
|
49
|
+
|
50
|
+
Scenario: JS/CSS from gems can be declared to be accessible
|
51
|
+
Given a fixture app "jquery-mobile-app"
|
52
|
+
Given a file named "config.rb" with:
|
53
|
+
"""
|
54
|
+
after_configuration do
|
55
|
+
sprockets.import_asset 'jquery.mobile'
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
And the Server is running at "jquery-mobile-app"
|
59
|
+
When I go to "/javascripts/jquery.mobile.js"
|
60
|
+
Then I should get a response with status "200"
|
61
|
+
|
62
|
+
Scenario: JS/CSS from gems are accessible when debugging assets and they are required
|
63
|
+
Given the Server is running at "sprockets-app-debug-assets"
|
64
|
+
And the Server is running at "sprockets-app-debug-assets"
|
65
|
+
When I go to "/index.html"
|
66
|
+
When I go to "/javascripts/bootstrap/alert.js?body=1"
|
67
|
+
Then I should get a response with status "200"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.command_name 'cucumber'
|
5
|
+
SimpleCov.start
|
6
|
+
|
7
|
+
# Pull in all of the gems including those in the `test` group
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.require :default, :test, :development
|
10
|
+
|
11
|
+
ENV['TEST'] = 'true'
|
12
|
+
ENV["AUTOLOAD_SPROCKETS"] = "true"
|
13
|
+
|
14
|
+
require "middleman-core"
|
15
|
+
require "middleman-core/step_definitions"
|
16
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-sprockets')
|
17
|
+
require "erubis"
|
18
|
+
|