knockout-assets 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c353d96962bcb8644bb2b8cda2ec4a649b46b4a
4
- data.tar.gz: 57e435eb596cc1ba068d99078779e8eb89eb9e89
3
+ metadata.gz: ba1bc4fa60bd970e93f6dfcfc0dfb9f53675452b
4
+ data.tar.gz: 967c46875db3cbdab77f87add574b4ec17d8208a
5
5
  SHA512:
6
- metadata.gz: badb8a216c7888c4aaf678c2d87378847ec40d4b6faae2a076def0cb061977949373b32d10aa956cdfdc60c34002097f90b504085b16771129ae797e3d8cd61a
7
- data.tar.gz: cc423b5c1c9c7ccb85b4188f491610c08d01593d12a71ea4b59bbfe0e189391f822948cf322d60bfb4b0689d221a46c9a9cbb3ec38ef0ec8ec65875208ad7625
6
+ metadata.gz: 023b20a422f13db66b402fd28aa1f9e14a8e862ef9073a620db4228e6bef6f9d95cb964161aeac01f322acac719d0858ddd09dd0f6af6f63a473c0647737a8a9
7
+ data.tar.gz: 847df5549d1e0bebe272a09e1f40593fe5ff8d917a53ee463f473d9333c652d48305f9096500a64910c27d9c8029eae2277cb293103e9a9f307f6f837f65b8bb
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## Version 0.0.4
2
+
3
+ Allow specifying `include` file regex.
4
+
1
5
  ## Version 0.0.3
2
6
 
3
- Adding alt attribute for better W3C validation
7
+ Adding alt attribute for better W3C validation.
4
8
 
5
9
  ## Version 0.0.2
6
10
 
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 =~ /.*\.(png|gif|jpg|jpeg|bmp)/ }.each { |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
@@ -1,3 +1,3 @@
1
1
  module KnockoutAssets
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  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.3
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: 2014-11-21 00:00:00.000000000 Z
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.2.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.