asset_paths_from_manifest 0.0.4 → 0.0.5
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 +40 -7
- data/lib/asset_paths_from_manifest/manifest.rb +1 -1
- data/lib/asset_paths_from_manifest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 534fb4aa8b559d6a35108dab782561beedf6d370
|
4
|
+
data.tar.gz: 36efc7dbe66584065b4e3f422528e66bf318dccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43f8aad44872aac842eb9b84a47ee526d011ea7da3b3909cd85b5e682a9c90da1c34fa25143585c13e0fc6094725426d273f48cb23c2937e84213b2a8511b5b6
|
7
|
+
data.tar.gz: 88a85673f32eeaa46270b8ca25ec18654b6dc6c09e8351d8ab5fec73cec6f6772cee257d797d845033ae8573dcdf1b49d71718734ec9907230cc3ea737f5498a
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# AssetPathsFromManifest
|
2
|
+
[](https://travis-ci.org/izumin5210/asset_paths_from_manifest)
|
3
|
+
[](https://badge.fury.io/rb/asset_paths_from_manifest)
|
4
|
+
[](https://github.com/izumin5210/asset_paths_from_manifest/blob/master/LICENSE.txt)
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
+
Provides view helpers to compute full paths for assets from manifest json file.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -16,13 +17,45 @@ And then execute:
|
|
16
17
|
|
17
18
|
$ bundle
|
18
19
|
|
19
|
-
|
20
|
+
## Usage
|
20
21
|
|
21
|
-
|
22
|
+
This module resolves asset paths using like following manifest json file.
|
22
23
|
|
23
|
-
|
24
|
+
```json
|
25
|
+
{
|
26
|
+
"client.js": "http://0.0.0.0:8080/client.js",
|
27
|
+
"client.js.map": "http://0.0.0.0:8080/client.js.map"
|
28
|
+
}
|
29
|
+
```
|
30
|
+
|
31
|
+
```json
|
32
|
+
{
|
33
|
+
"client.js": "/assets/client-8a4f666a18360aeafcfc.js"
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
For instance, these json files can be generated `manifest.json` using webpack via [webpack-manifest-plugin](https://www.npmjs.com/package/webpack-manifest-plugin).
|
38
|
+
|
39
|
+
This module provides `javascript_include_tag_from_manifest`, `stylesheet_link_tag_from_manifest` and `asset_paths_from_manifest` view helpers.
|
40
|
+
You can use these helpers instead of `ActionView::Helpers::AssetTagHelper`'s helpers to resolve asset paths.
|
41
|
+
|
42
|
+
```erb
|
43
|
+
<%= javascript_include_tag_from_manifest 'index' %>
|
44
|
+
<%= stylesheet_link_tag_from_manifest 'index' %>
|
45
|
+
```
|
46
|
+
|
47
|
+
This module use `public/assets/manifest.json` in default.
|
48
|
+
You can modify manifest file path on initializer.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
AssetPathsFromManifest.configure do |config|
|
52
|
+
config.manifest_json_path = Rails.root.join('public', 'client', 'manifest.json')
|
53
|
+
end
|
54
|
+
```
|
24
55
|
|
25
|
-
|
56
|
+
## Inspired
|
57
|
+
- [Squeezing Webpack into backend frameworks | Infinum](https://infinum.co/the-capsized-eight/squeezing-webpack-into-backend-frameworks)
|
58
|
+
- [webpacker/env.rb at master · rails/webpacker](https://github.com/rails/webpacker)
|
26
59
|
|
27
60
|
## Development
|
28
61
|
|