linner 0.8.6 → 0.8.7
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/CHANGELOG +3 -0
- data/docs/config.md +5 -2
- data/lib/linner.rb +6 -5
- data/lib/linner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ac3be13249f3a3e3ff674538df5b16d45e8b3d
|
4
|
+
data.tar.gz: fcb79fcbc3c710833afecb5ba8bb6cbae8558a8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be4eb198984459e6fd569dc6d69bdf01f82ff814d305d2f32549e97b29ea5cc679736ccd25b624d4e0feafbbeea30180b7b20061ae79734d9a1dffa9a10ffb45
|
7
|
+
data.tar.gz: 2676fb77d975e4a34f5e3c9cfcdb4f1d310f03769f7207cc5b4f07663966a444641817c8667a3b8bd326f72924bf17148548be9e48c62af22c725a3c5c5f67d1
|
data/CHANGELOG
CHANGED
data/docs/config.md
CHANGED
@@ -107,13 +107,16 @@ Default:
|
|
107
107
|
|
108
108
|
```yaml
|
109
109
|
revision:
|
110
|
-
prefix: ""
|
110
|
+
prefix: "/public"
|
111
|
+
cdn: "http://assets.yoursite.com"
|
111
112
|
manifest: "manifest.yml"
|
112
113
|
files:
|
113
114
|
- "index.html"
|
114
115
|
```
|
115
116
|
|
116
|
-
the `prefix` will join with revision hashes
|
117
|
+
the `prefix` will join with revision hashes.
|
118
|
+
|
119
|
+
the `cdn` will also join with revision hashes, so it will be like `http://assets.yoursite.com/public/assets/scripts/app.js`.
|
117
120
|
|
118
121
|
the `manifest` will join with `public` folder, write a manifest file with the name.
|
119
122
|
|
data/lib/linner.rb
CHANGED
@@ -43,6 +43,9 @@ module Linner
|
|
43
43
|
concat_assets = []
|
44
44
|
template_assets = []
|
45
45
|
sprite_assets = []
|
46
|
+
cdn = env.revision["cdn"] || ""
|
47
|
+
prefix = env.revision["prefix"] || ""
|
48
|
+
|
46
49
|
env.groups.each do |config|
|
47
50
|
concat_assets << config["concat"].keys if config["concat"]
|
48
51
|
template_assets << config["template"].keys if config["template"]
|
@@ -60,15 +63,14 @@ module Linner
|
|
60
63
|
name = File.basename(dest).sub /[^.]+\z/, "png"
|
61
64
|
dest = File.join env.sprites["path"], name
|
62
65
|
asset = Asset.new(File.join env.public_folder, dest)
|
63
|
-
prefix =
|
64
|
-
hash[dest] = prefix + asset.relative_digest_path
|
66
|
+
hash[prefix + dest] = cdn + prefix + asset.relative_digest_path
|
65
67
|
asset.revision!
|
66
68
|
|
67
69
|
(concat_assets + copy_assets).flatten.each do |file|
|
68
70
|
path = File.join env.public_folder, file
|
69
71
|
next unless Asset.new(path).stylesheet?
|
70
72
|
url = env.sprites["url"] || env.sprites["path"]
|
71
|
-
puts = File.read(path).gsub(File.join(url, File.basename(dest)), File.join(
|
73
|
+
puts = File.read(path).gsub(File.join(url, File.basename(dest)), File.join(cdn, url, File.basename(asset.relative_digest_path)))
|
72
74
|
File.open(path, "w") { |file| file << puts }
|
73
75
|
end
|
74
76
|
end
|
@@ -76,9 +78,8 @@ module Linner
|
|
76
78
|
# revision concat template and copy assets
|
77
79
|
(concat_assets + template_assets + copy_assets).flatten.each do |dest|
|
78
80
|
asset = Asset.new(File.join env.public_folder, dest)
|
79
|
-
prefix = env.revision["prefix"] || ""
|
80
81
|
next unless asset.revable?
|
81
|
-
hash[dest] = prefix + asset.relative_digest_path
|
82
|
+
hash[prefix + dest] = cdn + prefix + asset.relative_digest_path
|
82
83
|
asset.revision!
|
83
84
|
end
|
84
85
|
|
data/lib/linner/version.rb
CHANGED