bowerify 1.0.0 → 1.1.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/lib/bowerify/assets_processor.rb +16 -4
- data/lib/bowerify/railtie.rb +14 -2
- data/lib/bowerify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb2bff8a18c29320ed3358725922f7c8067b157
|
4
|
+
data.tar.gz: c0a9b09296af0a8e93548025fa8f4cc730e11c9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a437cac64117b488cf80a083b5596425e66d585181306f19a9e4d10c4c366a07e05f72ec8195ea123b7667e38fe09f9c0785f7cb2a6e0253266fd00dcccb2d27
|
7
|
+
data.tar.gz: a6725a52d7f0c6f483397dca2552742b0608b944830fc38625ab2a628face6c81a600bc9eb15ecadd21f524940762b4532f3f8f66161634cc9b0adfb436b72e7
|
@@ -2,7 +2,7 @@ class Bowerify::AssetsProcessor < Sprockets::Processor
|
|
2
2
|
CSS_URL_RE = /(url\(('|"|))((.+?)\.(gif|png|jpg|jpeg|ttf|svg|woff|eot))(.*?\2\))/
|
3
3
|
|
4
4
|
def evaluate(context, locals={})
|
5
|
-
if context.pathname
|
5
|
+
if bower_component?(context.pathname)
|
6
6
|
fix_assets_path data, context
|
7
7
|
else
|
8
8
|
data
|
@@ -14,14 +14,26 @@ class Bowerify::AssetsProcessor < Sprockets::Processor
|
|
14
14
|
s1, s2 = $1.dup, $6.dup
|
15
15
|
|
16
16
|
path = File.expand_path("#{context.pathname.dirname}/#{$3}")
|
17
|
-
|
17
|
+
bower_components_paths.each do |bower_path|
|
18
|
+
path = path.gsub("#{bower_path}/", "")
|
19
|
+
end
|
18
20
|
path = context.asset_path(path)
|
19
21
|
|
20
22
|
"#{s1}#{path}#{s2}"
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
|
-
def
|
25
|
-
|
26
|
+
def bower_component?(path)
|
27
|
+
bower_components_paths.each do |bower_path|
|
28
|
+
if path.to_s.starts_with?(bower_path)
|
29
|
+
return true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
false
|
34
|
+
end
|
35
|
+
|
36
|
+
def bower_components_paths
|
37
|
+
Array(Rails.application.config.bower_components_path).map(&:to_s)
|
26
38
|
end
|
27
39
|
end
|
data/lib/bowerify/railtie.rb
CHANGED
@@ -3,11 +3,23 @@ module Bowerify
|
|
3
3
|
railtie_name :bowerify
|
4
4
|
|
5
5
|
config.before_initialize do |app|
|
6
|
-
app.config.bower_components_path =
|
7
|
-
|
6
|
+
app.config.bower_components_path = [
|
7
|
+
Rails.root.join('lib', 'assets', 'components'),
|
8
|
+
Rails.root.join('vendor', 'assets', 'components')
|
9
|
+
]
|
8
10
|
|
9
11
|
app.assets.register_preprocessor 'text/css', Bowerify::AssetsProcessor
|
10
12
|
app.assets.register_preprocessor 'application/javascript', Bowerify::AssetsProcessor
|
11
13
|
end
|
14
|
+
|
15
|
+
config.after_initialize do |app|
|
16
|
+
app.config.assets.paths += Array(app.config.bower_components_path)
|
17
|
+
|
18
|
+
%w[png gif jpg jpeg ttf svg eot woff].each do |ext|
|
19
|
+
Array(app.config.bower_components_path).each do |bower_path|
|
20
|
+
config.assets.precompile += Dir.glob("#{bower_path}/**/*.#{ext}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
12
24
|
end
|
13
25
|
end
|
data/lib/bowerify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bowerify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Nemshilov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|