middleman-sprockets 3.4.2 → 3.5.0
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/.travis.yml +12 -7
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/README.md +8 -0
- data/Rakefile +1 -1
- data/features/ignore_imported_paths.feature +19 -0
- data/features/sprockets.feature +2 -2
- data/features/sprockets_gems.feature +3 -3
- data/features/step_definitions/server_steps.rb +13 -4
- data/lib/middleman-sprockets/asset.rb +4 -0
- data/lib/middleman-sprockets/config_only_environment.rb +6 -0
- data/lib/middleman-sprockets/environment.rb +15 -1
- data/lib/middleman-sprockets/extension.rb +7 -2
- data/lib/middleman-sprockets/version.rb +1 -1
- metadata +19 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f72f296a723b4ff315df8ae5613bebd5a7338a5
|
4
|
+
data.tar.gz: 23a9b9ea030bdc0dc0de50d17614896ac1e2cbaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6edd63315b2d4ffc601ce01fa4fe8a54595b5e9c4d70691552195fce9f754b9ac07af4f07e78d98132c1e884b5f8b8ee6dea711a90f7f705241fc6f259dca324
|
7
|
+
data.tar.gz: 0f51a95dba5ea25569b8a6a6e140d73b7f615c936a595e2d098c51db9b4606775e575f17d7bf3ce8f61340546adf6ef86a4be7342fea61b96af6c979cf2eda2d
|
data/.travis.yml
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
sudo: false
|
4
|
+
env: TEST=true
|
5
|
+
|
1
6
|
rvm:
|
2
|
-
- 1.9.3
|
3
7
|
- 2.0.0
|
4
|
-
- 2.1
|
5
|
-
- 2.
|
6
|
-
-
|
8
|
+
- 2.1
|
9
|
+
- 2.2.5
|
10
|
+
- 2.3.1
|
11
|
+
- ruby-head
|
7
12
|
|
8
13
|
gemfile:
|
9
14
|
- Gemfile
|
10
15
|
|
11
16
|
script: "bundle exec rake test"
|
12
17
|
|
13
|
-
env: TEST=true
|
14
|
-
|
15
18
|
matrix:
|
16
|
-
fast_finish: true
|
19
|
+
fast_finish: true
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -9,9 +9,8 @@ gem "rake", "~> 10.0.3", :require => false
|
|
9
9
|
gem "yard", "~> 0.8.0", :require => false
|
10
10
|
|
11
11
|
# Test tools
|
12
|
-
gem "cucumber"
|
13
|
-
gem "
|
14
|
-
gem "aruba"
|
12
|
+
gem "cucumber", "~> 2.0"
|
13
|
+
gem "aruba", "~> 0.10.0"
|
15
14
|
gem "rspec", "~> 3.0"
|
16
15
|
gem "builder", "~> 3.0"
|
17
16
|
gem "simplecov"
|
@@ -27,6 +26,7 @@ gem "jquery_mobile_rails", "1.4.1", :require => false
|
|
27
26
|
gem "ejs", "~> 1.1.1"
|
28
27
|
gem "eco", "~> 1.0.0"
|
29
28
|
gem "erubis", "~> 2.7.0"
|
29
|
+
gem "pry-byebug"
|
30
30
|
|
31
31
|
# Code Quality
|
32
32
|
gem "cane", :platforms => [:mri_19, :mri_20], :require => false
|
data/README.md
CHANGED
@@ -71,6 +71,14 @@ Be careful if you are using `bower`-components which place their assets in
|
|
71
71
|
need to use the `#import_asset`-call with the block to place it in the correct
|
72
72
|
directory.
|
73
73
|
|
74
|
+
**Ignoring imported assets**
|
75
|
+
|
76
|
+
Sometimes you may not wish to include all assets from an asset gem. For example lets take the jquery-mobile gem, it includes a bunch of images that you may not want included in your build. Pass a regex to match the path to `sprockets.ignore_path`. Like, `append_path`, you may add multiple.
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
sprockets.ignore_path /jquery\-mobile/
|
80
|
+
```
|
81
|
+
|
74
82
|
## Build & Dependency Status
|
75
83
|
|
76
84
|
[][gem]
|
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
|
10
10
|
exempt_tags = ["--tags ~@wip"]
|
11
11
|
exempt_tags << "--tags ~@new " unless Middleman::VERSION.start_with?("3.1")
|
12
12
|
exempt_tags << "--tags ~@old " unless Middleman::VERSION.start_with?("3.0")
|
13
|
-
t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict
|
13
|
+
t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict"
|
14
14
|
end
|
15
15
|
|
16
16
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Ignoring Imported Assets
|
2
|
+
Background: App with imported assets ignoring some of them
|
3
|
+
Given a fixture app "sprockets-app"
|
4
|
+
And a file named "config.rb" with:
|
5
|
+
"""
|
6
|
+
set :js_dir, "library/js"
|
7
|
+
set :css_dir, "library/css"
|
8
|
+
|
9
|
+
sprockets.ignore_path /jquery/
|
10
|
+
"""
|
11
|
+
And the Server is running
|
12
|
+
|
13
|
+
Scenario: Imported jquery assets are not in the sitemap (but others are)
|
14
|
+
Then the sitemap should not include "/images/jquery-mobile/ajax-loader.gif"
|
15
|
+
And the sitemap should include "/fonts/bootstrap/glyphicons-halflings-regular.eot"
|
16
|
+
|
17
|
+
Scenario: Assets from imported gem can still be required
|
18
|
+
When I go to "/library/js/jquery_include.js"
|
19
|
+
Then I should see "window.jQuery ="
|
data/features/sprockets.feature
CHANGED
@@ -107,9 +107,9 @@ Feature: Sprockets
|
|
107
107
|
Then I should see 'src="/library/images/cat.jpg"'
|
108
108
|
And I should see 'src="/library/images/cat-2.jpg"'
|
109
109
|
When I go to "/library/images/cat.jpg"
|
110
|
-
Then
|
110
|
+
Then the status code should be "200"
|
111
111
|
When I go to "/library/images/cat-2.jpg"
|
112
|
-
Then
|
112
|
+
Then the status code should be "200"
|
113
113
|
|
114
114
|
Scenario: Assets built through import_asset are built with the right extension
|
115
115
|
Given a successfully built app at "sprockets-app"
|
@@ -45,7 +45,7 @@ Feature: Sprockets Gems
|
|
45
45
|
Scenario: JS/CSS from gems aren't aumatically in the site
|
46
46
|
Given the Server is running at "jquery-mobile-app"
|
47
47
|
When I go to "/javascripts/jquery.mobile.js"
|
48
|
-
Then
|
48
|
+
Then the status code should be "404"
|
49
49
|
|
50
50
|
Scenario: JS/CSS from gems can be declared to be accessible
|
51
51
|
Given a fixture app "jquery-mobile-app"
|
@@ -57,11 +57,11 @@ Feature: Sprockets Gems
|
|
57
57
|
"""
|
58
58
|
And the Server is running at "jquery-mobile-app"
|
59
59
|
When I go to "/javascripts/jquery.mobile.js"
|
60
|
-
Then
|
60
|
+
Then the status code should be "200"
|
61
61
|
|
62
62
|
Scenario: JS/CSS from gems are accessible when debugging assets and they are required
|
63
63
|
Given the Server is running at "sprockets-app-debug-assets"
|
64
64
|
And the Server is running at "sprockets-app-debug-assets"
|
65
65
|
When I go to "/index.html"
|
66
66
|
When I go to "/javascripts/bootstrap/alert.js?body=1"
|
67
|
-
Then
|
67
|
+
Then the status code should be "200"
|
@@ -1,7 +1,16 @@
|
|
1
|
-
Then /^I should get a response with status "(.*?)"$/ do |status|
|
2
|
-
(@last_response || @browser.last_response).status.should == status.to_i
|
3
|
-
end
|
4
|
-
|
5
1
|
Given /^wait a second$/ do
|
6
2
|
sleep(1)
|
7
3
|
end
|
4
|
+
|
5
|
+
Given /^binding\.pry$/ do
|
6
|
+
require "pry"
|
7
|
+
binding.pry
|
8
|
+
end
|
9
|
+
|
10
|
+
Then /^the sitemap should not include "([^\"]*)"$/ do |path|
|
11
|
+
expect( @server_inst.sitemap.resources.map(&:url) ).not_to include path
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^the sitemap should include "([^\"]*)"$/ do |path|
|
15
|
+
expect( @server_inst.sitemap.resources.map(&:url) ).to include path
|
16
|
+
end
|
@@ -9,11 +9,13 @@ module Middleman
|
|
9
9
|
attr_reader :imported_assets
|
10
10
|
attr_reader :appended_paths
|
11
11
|
attr_reader :prepended_paths
|
12
|
+
attr_reader :ignored_paths
|
12
13
|
|
13
14
|
def initialize(options={})
|
14
15
|
@imported_assets = []
|
15
16
|
@appended_paths = []
|
16
17
|
@prepended_paths = []
|
18
|
+
@ignored_paths = []
|
17
19
|
end
|
18
20
|
|
19
21
|
def method_missing?(method)
|
@@ -45,6 +47,10 @@ module Middleman
|
|
45
47
|
def prepend_path(path)
|
46
48
|
@prepended_paths << path
|
47
49
|
end
|
50
|
+
|
51
|
+
def ignore_path(path)
|
52
|
+
@ignored_paths << path
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "middleman-sprockets/asset"
|
2
|
+
|
1
3
|
module Middleman
|
2
4
|
module Sprockets
|
3
5
|
# Generic Middleman Sprockets env
|
@@ -55,6 +57,18 @@ module Middleman
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
# Make sure all the defined imported assets still exist
|
61
|
+
def prune_imported_assets!
|
62
|
+
@imported_assets = @imported_assets.select do |a|
|
63
|
+
begin
|
64
|
+
a = Middleman::Sprockets::Asset.new(@app, a.logical_path, self)
|
65
|
+
a.exist?
|
66
|
+
rescue
|
67
|
+
false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
58
72
|
# Add our own customizations to the Sprockets context class
|
59
73
|
def enhance_context_class!
|
60
74
|
app = @app
|
@@ -234,7 +248,7 @@ module Middleman
|
|
234
248
|
args << asset_logical_path
|
235
249
|
args << determine_output_dir if block_given?
|
236
250
|
|
237
|
-
imported_assets << ImportedAsset.new(*args)
|
251
|
+
@imported_assets << ImportedAsset.new(*args)
|
238
252
|
|
239
253
|
@app.sitemap.rebuild_resource_list!(:sprockets_import_asset)
|
240
254
|
end
|
@@ -75,6 +75,7 @@ module Middleman
|
|
75
75
|
@environment = ::Middleman::Sprockets::Environment.new(app, :debug_assets => debug_assets)
|
76
76
|
config_environment.apply_to_environment(@environment)
|
77
77
|
|
78
|
+
@config_environment = config_environment
|
78
79
|
append_paths_from_gems
|
79
80
|
import_images_and_fonts_from_gems
|
80
81
|
|
@@ -95,6 +96,7 @@ module Middleman
|
|
95
96
|
def manipulate_resource_list(resources)
|
96
97
|
resources_list = []
|
97
98
|
|
99
|
+
environment.prune_imported_assets!
|
98
100
|
environment.imported_assets.each do |imported_asset|
|
99
101
|
asset = Middleman::Sprockets::Asset.new @app, imported_asset.logical_path, environment
|
100
102
|
if imported_asset.output_path
|
@@ -143,8 +145,11 @@ module Middleman
|
|
143
145
|
end
|
144
146
|
|
145
147
|
def import_images_and_fonts_from_gems
|
146
|
-
|
147
|
-
|
148
|
+
environment.paths
|
149
|
+
.reject { |p| p.start_with?(app.source_dir) }
|
150
|
+
.reject { |p| @config_environment.ignored_paths.any?{|r| r.match(p)}}
|
151
|
+
.select { |p| p.end_with?('images') || p.end_with?('fonts') }
|
152
|
+
.each do |load_path|
|
148
153
|
environment.each_entry(load_path) do |path|
|
149
154
|
if path.file? && !path.basename.to_s.start_with?('_')
|
150
155
|
logical_path = path.sub /^#{load_path}/, ''
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -10,62 +10,62 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3.3'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: sprockets
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - ~>
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 2.12.1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - ~>
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 2.12.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: sprockets-sass
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 1.3.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ~>
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 1.3.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: sprockets-helpers
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - ~>
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 1.1.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- - ~>
|
68
|
+
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 1.1.0
|
71
71
|
description: Sprockets support for Middleman
|
@@ -77,10 +77,10 @@ executables: []
|
|
77
77
|
extensions: []
|
78
78
|
extra_rdoc_files: []
|
79
79
|
files:
|
80
|
-
- .gitignore
|
81
|
-
- .rspec
|
82
|
-
- .simplecov
|
83
|
-
- .travis.yml
|
80
|
+
- ".gitignore"
|
81
|
+
- ".rspec"
|
82
|
+
- ".simplecov"
|
83
|
+
- ".travis.yml"
|
84
84
|
- CHANGELOG.md
|
85
85
|
- CONTRIBUTING.md
|
86
86
|
- Gemfile
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- features/asset_hash-3.0.feature
|
91
91
|
- features/asset_hash.feature
|
92
92
|
- features/bower.feature
|
93
|
+
- features/ignore_imported_paths.feature
|
93
94
|
- features/jst.feature
|
94
95
|
- features/long_filenames.feature
|
95
96
|
- features/sass_globs.feature
|
@@ -258,17 +259,17 @@ require_paths:
|
|
258
259
|
- lib
|
259
260
|
required_ruby_version: !ruby/object:Gem::Requirement
|
260
261
|
requirements:
|
261
|
-
- -
|
262
|
+
- - ">="
|
262
263
|
- !ruby/object:Gem::Version
|
263
264
|
version: '0'
|
264
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
266
|
requirements:
|
266
|
-
- -
|
267
|
+
- - ">="
|
267
268
|
- !ruby/object:Gem::Version
|
268
269
|
version: '0'
|
269
270
|
requirements: []
|
270
271
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
272
|
+
rubygems_version: 2.4.8
|
272
273
|
signing_key:
|
273
274
|
specification_version: 4
|
274
275
|
summary: Sprockets support for Middleman
|
@@ -276,6 +277,7 @@ test_files:
|
|
276
277
|
- features/asset_hash-3.0.feature
|
277
278
|
- features/asset_hash.feature
|
278
279
|
- features/bower.feature
|
280
|
+
- features/ignore_imported_paths.feature
|
279
281
|
- features/jst.feature
|
280
282
|
- features/long_filenames.feature
|
281
283
|
- features/sass_globs.feature
|