js-packer-rails 0.0.1 → 0.1.0

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
- SHA1:
3
- metadata.gz: be8656037311c739980bfa750443d267011d9a95
4
- data.tar.gz: 5e06acddc8209ff2125b9bad919130bfb359f536
2
+ SHA256:
3
+ metadata.gz: 8595018f505d7070e8e1ddd771029b7aead0cf13c84720891a18c791c9aec204
4
+ data.tar.gz: bfabe95949ce07c5eba7039aad031351bb0c20ab255234ec795a29ab5d407191
5
5
  SHA512:
6
- metadata.gz: 202d8dd58340b98a52d8741fdfd1ab51aa0f093c0ad912484183cc16e2c23a9569ac987fdcbc617cf08667717c4d0ee707f5b8ee86a34fec8c1feae2cb23075b
7
- data.tar.gz: d49b9451207e7f3983b9b99133fe15a3749c8534104eefe2a55ed4821e55b57fd5b070f492e152dfd05f92ee7bac95319b7083ba02c180b2d21a8f5eb32db734
6
+ metadata.gz: 0b43b865c8f85c203382c1ee750d9cdd5776a7a7a2f779f503270bb67d07f41f44a1e876517e786bed0f6c8c60b4e0e2aea41472bdd2106084f1eac7737e5e6d
7
+ data.tar.gz: 0cfa22626ba9c9801ee1cc6b390ec0333d89445c1ce0364cbf42e94a927adc85030236b2d2c192d47837a6ae386d2a66c0afb7656a354e85bb89d7174cecf009
data/README.md CHANGED
@@ -2,20 +2,30 @@
2
2
  The Packer allows you to easily include JavaScript bundle into your Rails project.
3
3
  JavaScript world offers a lot of great tools for bundling, uglifying, minifying... So, use it in your Rails app!
4
4
  It could be Webpack or Grunt or Gulp or Any New Awesome JS tool :)
5
- I believe the choice of the tools should depend on issues you want to solve, so use JS tool to prepare your source JS code.
5
+ I believe the choice of the tools should depend on the issues you want to solve, so use JS tool to bundle your source JS code.
6
6
 
7
7
  The Packer:
8
- * don't care how do you bundle your JavaScript
9
- * don't use Rails assets pipeline
10
- * is only for Rails framework
11
- * require JavaScript manifest file
12
- * add 3 helper methods to your view:
8
+ * doesn't care how do you bundle your JavaScript
9
+ * doesn't use Rails assets pipeline
10
+ * is dedicated only for Rails
11
+ * requires JavaScript manifest file
12
+ * adds 3 helper methods to your views:
13
13
  ```
14
14
  js_bundle_tag(*sources)
15
15
  js_bundle_hash(source)
16
16
  js_bundle_name(source)
17
17
  ```
18
18
 
19
+ ## Example
20
+
21
+ How to use `js-packer-rails` gem in Rails app with:
22
+
23
+ * Webpack
24
+ * Babel
25
+ * React
26
+
27
+ [https://github.com/jcieslar/js_packer_rails_example](https://github.com/jcieslar/js_packer_rails_example)
28
+
19
29
  ## Installation
20
30
 
21
31
  Add this line to your application's Gemfile:
@@ -36,7 +46,7 @@ Or install it yourself as:
36
46
 
37
47
  ### JavaScript manifest file
38
48
 
39
- Example format of manifest:
49
+ Generate manifest:
40
50
 
41
51
  ```json
42
52
  /* admin-bundle.json */
@@ -45,8 +55,8 @@ Example format of manifest:
45
55
  }
46
56
  ```
47
57
 
48
- So if your bundle name is: `bundle-example-name` then you have to generate manifest json:
49
- `bundle-example-name.json` which maps your bundle name into bundle name with hash:
58
+ So if your JS bundle name is: `bundle-example-name` then you have to generate the following manifest:
59
+ `bundle-example-name.json`
50
60
 
51
61
  ```json
52
62
  {
@@ -58,13 +68,15 @@ So if your bundle name is: `bundle-example-name` then you have to generate manif
58
68
 
59
69
  #### js_bundle_tag
60
70
 
61
- Just use `js_bundle_tag` in your view or layout by passing your bundle name:
71
+ Use `js_bundle_tag` helper in your view/layout by passing your JS bundle name as an argument.
72
+ It returns the script tag with the proper path to your JS bundle:
62
73
 
63
74
  ```
64
75
  <%= js_bundle_tag 'admin-bundle' %>
76
+ # => <script src='bundle/javascripts/admin-bundle-f65a6b9fb09ba93b7ea6.js'></script>
65
77
  ```
66
78
 
67
- If you would like to include more then one bundle for view or layout just add more bundle names:
79
+ If you would like to include more than one JS bundle, just add another argument:
68
80
 
69
81
  ```
70
82
  <%= js_bundle_tag 'admin-bundle', 'user-bundle' %>
@@ -72,31 +84,35 @@ If you would like to include more then one bundle for view or layout just add mo
72
84
 
73
85
  #### js_bundle_hash
74
86
 
75
- Helper `js_bundle_hash` would be useful to get your code version for your source maps:
87
+ Use `js_bundle_hash` helper to get your JS bundle code version:
76
88
 
77
89
  ```
78
90
  <%= js_bundle_hash 'admin-bundle' %>
91
+ # => f65a6b9fb09ba93b7ea6
79
92
  ```
80
93
 
81
94
  ### js_bundle_name
82
95
 
83
- Helper `js_bundle_name` return your bundle name with proper hash taken from manifest:
96
+ Use `js_bundle_name` helper to get your JS bundle full name with a hash:
84
97
 
85
98
  ```
86
99
  <%= js_bundle_name 'admin-bundle' %>
100
+ # => admin-bundle-f65a6b9fb09ba93b7ea6.js
87
101
  ```
88
102
 
89
103
  ### Bundle JavaScript
90
104
 
91
- Packer would be looking for JavaScript ` manifest` and `bundle` by default in directory `public/bundles/javascripts/`.
105
+ Put your JSON manifest and JS bundle in `public/bundles/javascripts/` directory.
92
106
 
93
107
  ### Configuration
94
108
 
95
- You can change default directory of your manifest and bundle via YAML file: `config/packer.yml`
109
+ You can change the default directory of your manifest and bundle via YAML file: `config/packer.yml`
96
110
 
97
- You can define paths by two params: `manifest_path` and `bundle_path`. Manifest and bundle should be in public directory. `manifest_path` should contain path starting from `public/` but `bundle_path` should skip `public/`
111
+ You can define paths by two params: `manifest_path` and `bundle_path`.
112
+ The manifest and bundle should be in the public directory.
113
+ `manifest_path` should contain the path starting from `public/` while the `bundle_path` should skip `public/`
98
114
 
99
- Example:
115
+ For example:
100
116
 
101
117
  ```yml
102
118
  default: &default
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jakub Cieslar"]
10
10
  spec.email = ["cieslar.jakub@gmail.com"]
11
11
 
12
- spec.summary = %q{Pack your JS bundle into Rails app! Use whatever tool you want for your JS assets}
13
- spec.description = %q{Pack your JS bundle into Rails app! Use whatever tool you want for your JS assets}
12
+ spec.summary = %q{Pack your JS bundle into Rails app! Use whatever tool you want for your JS assets. You do not need webpacker!}
13
+ spec.description = %q{Pack your JS bundle into Rails app! Use whatever tool you want for your JS assets. You do not need webpacker!}
14
14
  spec.homepage = "https://github.com/jcieslar/js-packer-rails"
15
15
  spec.license = "MIT"
16
16
 
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "railties", ">= 4.0.1"
24
+ spec.add_dependency "railties", ">= 4.0.13"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.16"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "rails", ">= 4.0.1"
28
+ spec.add_development_dependency "rails", ">= 4.0.13"
29
29
  end
@@ -1,7 +1,7 @@
1
1
  module Js
2
2
  module Packer
3
3
  module Rails
4
- VERSION = "0.0.1"
4
+ VERSION = "0.1.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js-packer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Cieslar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-19 00:00:00.000000000 Z
11
+ date: 2018-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.1
19
+ version: 4.0.13
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.1
26
+ version: 4.0.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,16 +58,16 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 4.0.1
61
+ version: 4.0.13
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 4.0.1
68
+ version: 4.0.13
69
69
  description: Pack your JS bundle into Rails app! Use whatever tool you want for your
70
- JS assets
70
+ JS assets. You do not need webpacker!
71
71
  email:
72
72
  - cieslar.jakub@gmail.com
73
73
  executables: []
@@ -104,9 +104,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.6.13
107
+ rubygems_version: 2.7.6
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Pack your JS bundle into Rails app! Use whatever tool you want for your JS
111
- assets
111
+ assets. You do not need webpacker!
112
112
  test_files: []