assets_precompile_enforcer 1.0.0 → 1.0.1
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.
data/README.md
CHANGED
@@ -26,6 +26,7 @@ You will need to move your `config.assets.precompile += ...` setting into `confi
|
|
26
26
|
|
27
27
|
You also need to add the following line to `config/environments/development.rb`:
|
28
28
|
|
29
|
+
# Forces included assets to be added to config.assets.precompile
|
29
30
|
config.assets.enforce_precompile = true
|
30
31
|
|
31
32
|
|
@@ -34,19 +35,19 @@ You will need to restart your Rails server whenever you make any changes to `con
|
|
34
35
|
|
35
36
|
## Advanced Usage
|
36
37
|
|
37
|
-
To avoid restarting your server when you change `config.assets.precompile`,
|
38
|
-
|
39
|
-
unless defined?(OriginalAssetsPrecompile)
|
40
|
-
OriginalAssetsPrecompile = Rails.application.config.assets.precompile.dup
|
41
|
-
end
|
42
|
-
Rails.application.config.assets.precompile = OriginalAssetsPrecompile + %w( extra_assets.js )
|
43
|
-
|
44
|
-
Add the following lines to `config/application.rb`:
|
38
|
+
To avoid restarting your server when you change `config.assets.precompile`, add the following lines to `config/application.rb`:
|
45
39
|
|
46
40
|
# Reload config/assets_precompile when changed
|
41
|
+
config.assets.original_precompile = config.assets.precompile.dup
|
47
42
|
config.to_prepare { load 'config/assets_precompile.rb' }
|
48
43
|
config.watchable_files << 'config/assets_precompile.rb'
|
49
44
|
|
45
|
+
Then move your `config.assets.precompile` settings to a new file at `config/assets_precompile.rb`:
|
46
|
+
|
47
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
48
|
+
assets = Rails.application.config.assets
|
49
|
+
assets.precompile = assets.original_precompile + %w( extra_assets.js )
|
50
|
+
|
50
51
|
Now you will be able to make changes to `config/assets_precompile.rb` without needing to restart your server.
|
51
52
|
|
52
53
|
|
@@ -13,7 +13,7 @@ module Sprockets
|
|
13
13
|
|
14
14
|
def stylesheet_link_tag_with_enforced_precompile(*sources)
|
15
15
|
sources_without_options(sources).each do |source|
|
16
|
-
ensure_asset_will_be_precompiled!(source, '
|
16
|
+
ensure_asset_will_be_precompiled!(source, 'css') if enforce_precompile?
|
17
17
|
end
|
18
18
|
stylesheet_link_tag_without_enforced_precompile(*sources)
|
19
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assets_precompile_enforcer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
segments:
|
45
45
|
- 0
|
46
|
-
hash:
|
46
|
+
hash: 3045371973764442935
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
none: false
|
49
49
|
requirements:
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
hash:
|
55
|
+
hash: 3045371973764442935
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
58
|
rubygems_version: 1.8.24
|