webpack-assets 0.3.1 → 0.3.2

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: 9ede827fa5e12eaa04d9d43d362074d81ef5bca2
4
- data.tar.gz: 7d510b3fc8d947b92981c1e1070ee3a8f7e31634
3
+ metadata.gz: 0cb14b7a8b81ab6a047e5e0b2570156529551fa3
4
+ data.tar.gz: f296dd39284bb066dd4175bab85c7d6d7676a496
5
5
  SHA512:
6
- metadata.gz: 155c5f5063ae98dd66ee6b3468eb6aed9a8336c721a23dd095d45c75f431946d3b29591d090aeb7a157cd3977ec8ade09e91635e3ae01ddbc61627e508e7841a
7
- data.tar.gz: 032fe6bfa3a2f3adfbb7297fe6938a091fbb377c2fd8b7b085aa393d6eea349e89397837fe44fb48244c3703345fdd6f9bc49e0680ae30d79c399b70e59d60c3
6
+ metadata.gz: bfc0762e61db53659c6a783c513be37e668ac34e8ded0654fbfc0ca632dbd55a8b6289cef626a311b5a4e7a95b8b963f060766370674b9805896ffdb7dda08b0
7
+ data.tar.gz: 92e02b9b493ca80612cf8e68d87153e34adeec5c87068ad35a0a2685712349fe8f58ef975d14983d9c63195d0a8d08731c0437d5904fd1e4cd4c1308dc7c7e4c
data/README.md CHANGED
@@ -49,6 +49,8 @@ Optional settings:
49
49
 
50
50
  - `host` - the host with the port webpack dev server is running on (can be used instead of `port` option).
51
51
 
52
+ - `cdn_host` - the CDN host (will be prepended to URLs for all files).
53
+
52
54
  Example usage:
53
55
 
54
56
  ```ruby
@@ -61,8 +63,6 @@ Optional settings:
61
63
  end
62
64
  ```
63
65
 
64
- - `cdn_host` - the CDN host (used only in `webpack_static_file_url` for now).
65
-
66
66
  View helpers:
67
67
 
68
68
  - `webpack_js_tag` is a replacement for `javascript_include_tag`.
@@ -20,6 +20,10 @@ module Webpack
20
20
  config.validate!
21
21
  end
22
22
 
23
+ def reset
24
+ @config = nil
25
+ end
26
+
23
27
  # @param entries [Hash]
24
28
  def load_entries(entries)
25
29
  @entries = entries
@@ -1,5 +1,5 @@
1
1
  module Webpack
2
2
  module Assets
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
5
5
  end
@@ -38,7 +38,8 @@ module Webpack
38
38
  if Webpack.config.use_server
39
39
  server_url("#{name}.#{ext}")
40
40
  else
41
- Webpack.fetch_entry(name.to_s, ext.to_s)
41
+ entry = Webpack.fetch_entry(name.to_s, ext.to_s)
42
+ full_url(entry)
42
43
  end
43
44
  end
44
45
 
@@ -47,16 +48,20 @@ module Webpack
47
48
  server_url(path)
48
49
  else
49
50
  static_file = Webpack.fetch_static_file("#{Webpack.config.static_path}/#{path}")
50
- if Webpack.config.cdn_host.present?
51
- "#{protocol}#{Webpack.config.cdn_host}#{static_file}"
52
- else
53
- static_file
54
- end
51
+ full_url(static_file)
55
52
  end
56
53
  end
57
54
 
58
55
  private
59
56
 
57
+ def full_url(path)
58
+ if Webpack.config.cdn_host.present?
59
+ [protocol, Webpack.config.cdn_host, path].join
60
+ else
61
+ path
62
+ end
63
+ end
64
+
60
65
  def server_url(path)
61
66
  "#{protocol}#{server_host}#{Webpack.config.public_path}/#{path}"
62
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Nartimov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  requirements: []
126
126
  rubyforge_project:
127
- rubygems_version: 2.4.5
127
+ rubygems_version: 2.6.12
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Webpack Assets for Rails.