bun_bun_bundle 0.1.1 → 0.1.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 +4 -4
- data/README.md +3 -10
- data/lib/bun_bun_bundle/hanami.rb +2 -19
- data/lib/bun_bun_bundle/railtie.rb +1 -7
- data/lib/bun_bun_bundle/version.rb +1 -1
- data/lib/bun_bun_bundle.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c51a065b214293e85467dfdd10f2c84bf763f65fe27d0b549b175ea7448563bf
|
|
4
|
+
data.tar.gz: f2d86b5d3650797b617fa3ecee6d3dac119d97850749bc830172bfa12cb83dfe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c87530160b4f6829e32f7fc82c4f0d9180aa13b03089011fdb237d8daa4973453bd9cd074bd0402736f7fcab49e7d40c98f9b7fbb1a094aa07f718cd94ca9ac4
|
|
7
|
+
data.tar.gz: 0cbad61b7eff7af29f38cab146f09941a8f3dbd9354a1c470d36a35f94bbb36484543f7a06ef27e4810f2a1f51becb00026c7206de30e6b0049334cd224127fd
|
data/README.md
CHANGED
|
@@ -87,21 +87,16 @@ stale asset caching.
|
|
|
87
87
|
# config/app.rb
|
|
88
88
|
|
|
89
89
|
require 'bun_bun_bundle/hanami'
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
2. Optionally add the dev cache middleware:
|
|
93
|
-
|
|
94
|
-
```ruby
|
|
95
|
-
# config/app.rb
|
|
96
90
|
|
|
97
91
|
module MyApp
|
|
98
92
|
class App < Hanami::App
|
|
93
|
+
BunBunBundle.setup(root: root)
|
|
99
94
|
config.middleware.use BunBunBundle::DevCacheMiddleware if Hanami.env?(:development)
|
|
100
95
|
end
|
|
101
96
|
end
|
|
102
97
|
```
|
|
103
98
|
|
|
104
|
-
|
|
99
|
+
2. Include the helpers in your views:
|
|
105
100
|
|
|
106
101
|
```ruby
|
|
107
102
|
# app/views/helpers.rb
|
|
@@ -129,9 +124,7 @@ stale asset caching.
|
|
|
129
124
|
```ruby
|
|
130
125
|
require 'bun_bun_bundle'
|
|
131
126
|
|
|
132
|
-
|
|
133
|
-
BunBunBundle.config = BunBunBundle::Config.load(root: __dir__)
|
|
134
|
-
BunBunBundle.manifest = BunBunBundle::Manifest.load(root: __dir__)
|
|
127
|
+
BunBunBundle.setup(root: __dir__)
|
|
135
128
|
|
|
136
129
|
# Optionally set a CDN host
|
|
137
130
|
BunBunBundle.asset_host = 'https://cdn.example.com'
|
|
@@ -5,10 +5,11 @@ module BunBunBundle
|
|
|
5
5
|
#
|
|
6
6
|
# Add to your Hanami app's config/app.rb:
|
|
7
7
|
#
|
|
8
|
-
# require
|
|
8
|
+
# require 'bun_bun_bundle/hanami'
|
|
9
9
|
#
|
|
10
10
|
# module MyApp
|
|
11
11
|
# class App < Hanami::App
|
|
12
|
+
# BunBunBundle.setup(root: root)
|
|
12
13
|
# config.middleware.use BunBunBundle::DevCacheMiddleware if Hanami.env?(:development)
|
|
13
14
|
# end
|
|
14
15
|
# end
|
|
@@ -25,22 +26,4 @@ module BunBunBundle
|
|
|
25
26
|
# end
|
|
26
27
|
# end
|
|
27
28
|
#
|
|
28
|
-
module HanamiIntegration
|
|
29
|
-
def self.setup(root: Dir.pwd)
|
|
30
|
-
BunBunBundle.config = Config.load(root: root)
|
|
31
|
-
|
|
32
|
-
BunBunBundle.manifest = if BunBunBundle.development?
|
|
33
|
-
Manifest.load(root: root)
|
|
34
|
-
else
|
|
35
|
-
Manifest.load(root: root, retries: 1, delay: 0)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# Auto-setup when loaded in a Hanami app.
|
|
42
|
-
if defined?(Hanami)
|
|
43
|
-
Hanami::App.after :configure do
|
|
44
|
-
BunBunBundle::HanamiIntegration.setup(root: root.to_s)
|
|
45
|
-
end
|
|
46
29
|
end
|
|
@@ -13,13 +13,7 @@ module BunBunBundle
|
|
|
13
13
|
|
|
14
14
|
initializer 'bun_bun_bundle.manifest' do |app|
|
|
15
15
|
config.after_initialize do
|
|
16
|
-
BunBunBundle.
|
|
17
|
-
|
|
18
|
-
BunBunBundle.manifest = if BunBunBundle.development?
|
|
19
|
-
Manifest.load(root: app.root.to_s)
|
|
20
|
-
else
|
|
21
|
-
Manifest.load(root: app.root.to_s, retries: 1, delay: 0)
|
|
22
|
-
end
|
|
16
|
+
BunBunBundle.setup(root: app.root)
|
|
23
17
|
end
|
|
24
18
|
end
|
|
25
19
|
|
data/lib/bun_bun_bundle.rb
CHANGED
|
@@ -36,6 +36,14 @@ module BunBunBundle
|
|
|
36
36
|
environment == 'production'
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
# Loads config and manifest. Call this from Hanami's config/app.rb or
|
|
40
|
+
# any Rack app's startup.
|
|
41
|
+
def setup(root: Dir.pwd)
|
|
42
|
+
self.config = Config.load(root: root.to_s)
|
|
43
|
+
options = development? ? {} : { retries: 1, delay: 0 }
|
|
44
|
+
self.manifest = Manifest.load(root: root.to_s, **options)
|
|
45
|
+
end
|
|
46
|
+
|
|
39
47
|
# Returns the path to the bundled JS files shipped with the gem.
|
|
40
48
|
def bun_path
|
|
41
49
|
File.expand_path('bun', __dir__)
|