knockout-assets 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +9 -3
- data/app/helpers/knockout_assets.rb +3 -2
- data/lib/knockout/assets/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba1bc4fa60bd970e93f6dfcfc0dfb9f53675452b
|
4
|
+
data.tar.gz: 967c46875db3cbdab77f87add574b4ec17d8208a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 023b20a422f13db66b402fd28aa1f9e14a8e862ef9073a620db4228e6bef6f9d95cb964161aeac01f322acac719d0858ddd09dd0f6af6f63a473c0647737a8a9
|
7
|
+
data.tar.gz: 847df5549d1e0bebe272a09e1f40593fe5ff8d917a53ee463f473d9333c652d48305f9096500a64910c27d9c8029eae2277cb293103e9a9f307f6f837f65b8bb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -26,20 +26,26 @@ this method, unless the templates are generated in the first place using erb or
|
|
26
26
|
|
27
27
|
Using [Knockout Assets](https://github.com/hlascelles/knockout-assets) has three advantages over using a standard _image_tag_ in knockout templates.
|
28
28
|
|
29
|
-
* The knockout templates files need not be processed on the server side at all. This means that testing them (for example with [Jasmine](http://pivotal.github.io/jasmine) becomes possible
|
29
|
+
* The knockout templates files need not be processed on the server side at all. This means that testing them (for example with [Jasmine](http://pivotal.github.io/jasmine)) becomes possible.
|
30
30
|
* The templates may be served up from a CDN using [Knockout.js-External-Template-Engine](https://github.com/ifandelse/Knockout.js-External-Template-Engine).
|
31
31
|
* The images are preloaded by default so templates render with the correct layout instantly (but this can be optionally disabled).
|
32
32
|
|
33
33
|
## Options
|
34
34
|
|
35
|
-
Exclude some images using a regex
|
35
|
+
Include/Exclude some images using a regex
|
36
|
+
|
37
|
+
<%= knockout_assets(include: /.*\.(png|gif|jpg|jpeg|bmp|svg)/) %>
|
38
|
+
|
39
|
+
or
|
36
40
|
|
37
41
|
<%= knockout_assets(exclude: /im.*\//) %>
|
38
42
|
|
43
|
+
Or use both (exclude wins).
|
44
|
+
|
39
45
|
Disable preloading images
|
40
46
|
|
41
47
|
<%= knockout_assets(preload: false) %>
|
42
48
|
|
43
49
|
## License
|
44
50
|
|
45
|
-
MIT License.
|
51
|
+
MIT License.
|
@@ -3,11 +3,12 @@ module KnockoutAssets
|
|
3
3
|
options = {
|
4
4
|
exclude: nil,
|
5
5
|
preload: true,
|
6
|
+
include: /.*\.(png|gif|jpg|jpeg|bmp|svg)/,
|
6
7
|
}.merge(options)
|
7
8
|
|
8
9
|
files = {}
|
9
10
|
Rails.application.config.assets.paths.each { |p|
|
10
|
-
Dir["#{p}/**/*"].select { |f| f =~
|
11
|
+
Dir["#{p}/**/*"].select { |f| f =~ options[:include] }.each { |f|
|
11
12
|
item_path = f[p.length+1..-1]
|
12
13
|
if !options[:exclude] || options[:exclude] !~ item_path
|
13
14
|
files[item_path] = path_to_image(item_path)
|
@@ -17,4 +18,4 @@ module KnockoutAssets
|
|
17
18
|
|
18
19
|
render :partial => '/knockout_assets', locals: {asset_files: files, preload: options[:preload]}
|
19
20
|
end
|
20
|
-
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knockout-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
62
62
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
63
|
+
rubygems_version: 2.4.5.1
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: Prepares the SHA values of CDN assets for inclusion in templates.
|