react-rails-img 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1554ede34a6b1d68694d316e02526b9cd0479ee
4
- data.tar.gz: 219be609a27b582a86d78af74eae37875ba446b6
3
+ metadata.gz: 92bbf43b988ae4241a44c672de0056376640608a
4
+ data.tar.gz: a873991113e97b07633fc36fd5cdd3b3f5c59d2d
5
5
  SHA512:
6
- metadata.gz: 36c0eefb568f45b10a6e8a2c7b07c42ab228cac20bdaaa7d3ff32709d6ff39266d4e2ceb144501f5b87793715f0e4b5ccb0b82396bcff31700a31b85f3cb5d9e
7
- data.tar.gz: e3fc9155fd6f91b1dd2a63bcf7a2f89bb4007e45062642ec8ccb8ffb569d83e560c65000d185d074aac377b90c5eae9811f344834996ef239d0eba34e28a48e2
6
+ metadata.gz: c7226114309a51b81f40c45f8caed43f66a20176f992ab32398b198bb1b50dde9166d040162d3c1ff0364a72dd7ee47f4ea39824465355e4ae2d6cda8792efbb
7
+ data.tar.gz: e197d567926bc03fecaab7af1af528ff09cf1d92014984a0d1e8b2d521c5d0f0ec16806bc8276a8ca5fd95a20037f98559cbaf607548366963ceaa0b394073c3
data/README.md CHANGED
@@ -44,7 +44,10 @@ just similar to rails helper `image_tag`
44
44
  2. with props: e.g.: `imageTag('path/logo.png', {alt: 'logo', className: 'logo', id: 'logo', width: 100, height: 50})`
45
45
 
46
46
 
47
-
47
+ ### helper for getting image path
48
+
49
+ e.g.: `Img.assetPath('placeholder/logo.png')`
50
+
48
51
  ## Acknowledgements
49
52
 
50
53
  the image path will respect `Rails.env`, for development it will be sth like
@@ -1,7 +1,7 @@
1
1
  module React
2
2
  module Rails
3
3
  module Img
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
@@ -4,15 +4,11 @@ prefix = Rails.application.config.assets.prefix
4
4
  should_compute_assets_path = Rails.env.production? # for performance
5
5
  if should_compute_assets_path
6
6
  images_dir = Rails.root.join('app/assets/images/').to_s
7
- assets.each_file do |file_path|
8
- if file_path.starts_with?(images_dir)
9
- file_name = file_path.sub(images_dir, '')
10
- file_path =
11
- if Rails.application.config.assets.digest
12
- File.join('/', prefix, Rails.application.assets[file_name].digest_path)
13
- else
14
- File.join('/', prefix, file_name)
15
- end
7
+ images_enumerator = defined?(assets) ? assets.each_file : Dir["#{images_dir}**/*.*"]
8
+ images_enumerator.each do |file_path|
9
+ if file_path.to_s.starts_with?(images_dir)
10
+ file_name = File.basename file_path
11
+ file_path = asset_path(file_name)
16
12
  images[file_name] = file_path
17
13
  end
18
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-rails-img
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - RainChen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  version: '0'
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.4.6
82
+ rubygems_version: 2.5.1
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: simple image helpers for the rails project using react