react-webpacker 1.1.0 → 1.2.0
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 +4 -4
- data/README.md +2 -2
- data/lib/react-webpacker/use_components.rb +2 -2
- data/lib/react-webpacker/version.rb +1 -1
- data/package.json +1 -1
- data/react-webpacker.gemspec +1 -1
- data/test/react-webpacker_test.js +1 -1
- data/test/react-webpacker_test.rb +2 -2
- data/test/use-components_expected.html +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 233e4ef4917b2a68277fc40685618699cd5839cbb20e27506556ac3116f99a64
|
4
|
+
data.tar.gz: 206e9cbedd7f030eebd9db2fc36562472b3562ce25f130c560424bc0efebf875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee5246ff2d580f2f828d9216ee8a0d964df7e74f9c9e217100f5d700e311ff99aff2398bf42be935bb93f3799d8ac7ac1e78f8f587365434f76fa4cf123e0f2
|
7
|
+
data.tar.gz: 44d746b97fd7ed82086bcc1779edcfb4bf81a8d0918c5f678a75853b69f3fb2f93e07a24afb486471a3353b07ce70e8158d91a9de8f384fd0f3d5936e3404e6d
|
data/README.md
CHANGED
@@ -26,10 +26,10 @@ ReactWebpacker.render()
|
|
26
26
|
- `react-webpacker` script should be called **ONCE** per rendered html page, **DON'T** call in looped views.
|
27
27
|
- DOM is rendered in order from the top, so you should call `react-webpacker` script after `use_components` and `render_component`
|
28
28
|
```slim
|
29
|
-
= use_components(['YourCoolComponent'])
|
29
|
+
= use_components(['path/to/YourCoolComponent'])
|
30
30
|
= render_component('YourCoolComponent', {props_object: :value})
|
31
31
|
|
32
|
-
= javascript_pack_tag 'react-webpacker'
|
32
|
+
= javascript_pack_tag 'react-webpacker'
|
33
33
|
```
|
34
34
|
|
35
35
|
## Compared with `React-Rails` and `React on Rails`
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ReactWebpacker
|
2
2
|
# @param [Array<String>] components
|
3
|
-
def use_components(components = [])
|
4
|
-
components.map { |component| javascript_pack_tag component }
|
3
|
+
def use_components(components = [], options = {})
|
4
|
+
components.map { |component| javascript_pack_tag component, options }
|
5
5
|
.join("\n").html_safe
|
6
6
|
end
|
7
7
|
end
|
data/package.json
CHANGED
data/react-webpacker.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.version = ReactWebpacker::VERSION
|
7
7
|
s.authors = ['euxn23']
|
8
8
|
s.email = 'euxn23@gmail.com'
|
9
|
-
s.homepage = 'https://github.com/euxn23/webpacker
|
9
|
+
s.homepage = 'https://github.com/euxn23/react-webpacker'
|
10
10
|
s.summary = 'The smallest, enoughly-tested library for react with webpacker.'
|
11
11
|
s.license = 'MIT'
|
12
12
|
s.required_ruby_version = '>= 2.3.0'
|
@@ -12,13 +12,13 @@ class ReactWebpackerTest < ActionView::TestCase
|
|
12
12
|
|
13
13
|
def test_use_components
|
14
14
|
pack_tag_stub = Proc.new do |arg|
|
15
|
-
"<script src=\"/packs/#{arg}.js\"></script>"
|
15
|
+
"<script src=\"/packs/#{arg}.js\" defer=\"defer\"></script>"
|
16
16
|
end
|
17
17
|
File.open 'test/use-components_expected.html' do |f|
|
18
18
|
stub('javascript_pack_tag', pack_tag_stub) do
|
19
19
|
components = ['components/MyComponent']
|
20
20
|
expect_tags = f.read.chomp
|
21
|
-
assert_equal expect_tags, use_components(components)
|
21
|
+
assert_equal expect_tags, use_components(components, defer: true)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -1 +1 @@
|
|
1
|
-
<script src="/packs/components/MyComponent.js"></script>
|
1
|
+
<script src="/packs/components/MyComponent.js" defer="defer"></script>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react-webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- euxn23
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: euxn23@gmail.com
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- test/use-components_expected.html
|
46
46
|
- webpack.config.js
|
47
47
|
- yarn.lock
|
48
|
-
homepage: https://github.com/euxn23/webpacker
|
48
|
+
homepage: https://github.com/euxn23/react-webpacker
|
49
49
|
licenses:
|
50
50
|
- MIT
|
51
51
|
metadata: {}
|