non-stupid-digest-assets 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/non-stupid-digest-assets.rb +28 -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: 030252475e6d337adfc4a1a3a7dc07cdfa110ca4
|
4
|
+
data.tar.gz: f3e3638cf97a5e53a43b163737f4c253004de98b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e209cf69ac8bc6b4fc4d8f3c24b35c145ceefa9725ab49d0effb59fcb221cc52de9be81cff2c6c49392d1f608499a8f53e1b9e245fdb3d031c9bdcdde0b20e94
|
7
|
+
data.tar.gz: c7e57bb6fef7f8fc22235cfce69fe05c2ba3a160a3926c57c23f60475a40b5620059440bc102164ce022e7abc9d92b844a13a767881cc6b67a10748af90187de
|
data/README.md
CHANGED
@@ -15,6 +15,17 @@ Just put it in your Gemfile
|
|
15
15
|
gem "non-stupid-digest-assets"
|
16
16
|
```
|
17
17
|
|
18
|
+
If you want to whitelist non-digest assets for only certain files, you can configure a whitelist like this:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
# config/initializers/non_digest_assets.rb
|
22
|
+
|
23
|
+
NonStupidDigestAssets.whitelist = [/tinymce\/.*/, "full/file/path.txt"]
|
24
|
+
```
|
25
|
+
|
26
|
+
Be sure to give either a regex that will match the right assets or a full
|
27
|
+
path to the asset in question.
|
28
|
+
|
18
29
|
But shouldn't I always use the Rails asset helpers anyway?
|
19
30
|
----------------------------------------------------------
|
20
31
|
|
@@ -1,9 +1,36 @@
|
|
1
|
+
module NonStupidDigestAssets
|
2
|
+
mattr_accessor :whitelist
|
3
|
+
@@whitelist = []
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def files(files)
|
7
|
+
return files if whitelist.empty?
|
8
|
+
whitelisted_files(files)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def whitelisted_files(files)
|
14
|
+
files.select do |file, info|
|
15
|
+
whitelist.any? do |item|
|
16
|
+
case item
|
17
|
+
when Regexp
|
18
|
+
info['logical_path'] =~ item
|
19
|
+
else
|
20
|
+
info['logical_path'] == item
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
1
28
|
module Sprockets
|
2
29
|
class Manifest
|
3
30
|
def compile_with_non_digest *args
|
4
31
|
compile_without_non_digest *args
|
5
32
|
|
6
|
-
files.each do |(digest_path, info)|
|
33
|
+
NonStupidDigestAssets.files(files).each do |(digest_path, info)|
|
7
34
|
full_digest_path = File.join dir, digest_path
|
8
35
|
full_digest_gz_path = "#{full_digest_path}.gz"
|
9
36
|
full_non_digest_path = File.join dir, info['logical_path']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: non-stupid-digest-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Speller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Rails 4, much to everyone's annoyance, provides no option to generate both digest
|