bun_bun_bundle 0.1.0 → 0.1.1
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/lib/bun_bun_bundle/helpers.rb +5 -3
- data/lib/bun_bun_bundle/reload_tag.rb +4 -1
- data/lib/bun_bun_bundle/safe_html.rb +13 -0
- data/lib/bun_bun_bundle/version.rb +1 -1
- data/lib/bun_bun_bundle.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0147bb8b129e07166e23ff072f9584d494d0b0e19a23683801eb219c9261a44d
|
|
4
|
+
data.tar.gz: 168319c3d11b60be7dbee3cdd25d7a7138278d6ac957497db8c931f8c5e4247e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6738f2d988e2e3cf5b7b0a0ca74c978f9b1859bd0fafa0030327b25b5f5ad186b51df73655a5d5a9bfec8888f265ea646be28a79090dd678fe485acf3d7f5f01
|
|
7
|
+
data.tar.gz: b6e160279c5f610cee7fc4c6b5d868b7e320ee648b6810b1dc12c1d999c6e7ae9bc0bb5803e4d288fa6f14ea21bb3247c0f5a6293b58bfb2b537af5df7399afd
|
|
@@ -13,6 +13,8 @@ module BunBunBundle
|
|
|
13
13
|
# <%= bun_css_tag("css/app.css") %>
|
|
14
14
|
#
|
|
15
15
|
module Helpers
|
|
16
|
+
include SafeHtml
|
|
17
|
+
|
|
16
18
|
# Returns the public path to an asset from the manifest.
|
|
17
19
|
#
|
|
18
20
|
# Prepends the configured public_path and asset_host:
|
|
@@ -33,7 +35,7 @@ module BunBunBundle
|
|
|
33
35
|
def bun_js_tag(source, **options)
|
|
34
36
|
src = bun_asset(source)
|
|
35
37
|
attrs = { type: 'text/javascript' }.merge(options).merge(src: src)
|
|
36
|
-
%(<script #{_bun_html_attrs(attrs)}></script>)
|
|
38
|
+
_bun_safe(%(<script #{_bun_html_attrs(attrs)}></script>))
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# Generates a <link> tag for a CSS entry point.
|
|
@@ -44,7 +46,7 @@ module BunBunBundle
|
|
|
44
46
|
def bun_css_tag(source, **options)
|
|
45
47
|
href = bun_asset(source)
|
|
46
48
|
attrs = { type: 'text/css', rel: 'stylesheet' }.merge(options).merge(href: href)
|
|
47
|
-
%(<link #{_bun_html_attrs(attrs)}>)
|
|
49
|
+
_bun_safe(%(<link #{_bun_html_attrs(attrs)}>))
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
# Generates an <img> tag for an image asset.
|
|
@@ -56,7 +58,7 @@ module BunBunBundle
|
|
|
56
58
|
src = bun_asset(source)
|
|
57
59
|
alt = options.delete(:alt) || File.basename(source, '.*').tr('-_', ' ').capitalize
|
|
58
60
|
attrs = { alt: alt }.merge(options).merge(src: src)
|
|
59
|
-
%(<img #{_bun_html_attrs(attrs)}>)
|
|
61
|
+
_bun_safe(%(<img #{_bun_html_attrs(attrs)}>))
|
|
60
62
|
end
|
|
61
63
|
|
|
62
64
|
private
|
|
@@ -10,6 +10,8 @@ module BunBunBundle
|
|
|
10
10
|
# Only outputs content when BunBunBundle.development? is true.
|
|
11
11
|
#
|
|
12
12
|
module ReloadTag
|
|
13
|
+
include SafeHtml
|
|
14
|
+
|
|
13
15
|
# Returns the live reload <script> tag, or an empty string in production.
|
|
14
16
|
#
|
|
15
17
|
# Example (ERB):
|
|
@@ -24,7 +26,7 @@ module BunBunBundle
|
|
|
24
26
|
"#{config.public_path}/#{key}"
|
|
25
27
|
end
|
|
26
28
|
|
|
27
|
-
<<~HTML
|
|
29
|
+
html = <<~HTML
|
|
28
30
|
<script>
|
|
29
31
|
(() => {
|
|
30
32
|
const cssPaths = #{css_paths.to_json};
|
|
@@ -56,6 +58,7 @@ module BunBunBundle
|
|
|
56
58
|
})()
|
|
57
59
|
</script>
|
|
58
60
|
HTML
|
|
61
|
+
_bun_safe(html)
|
|
59
62
|
end
|
|
60
63
|
end
|
|
61
64
|
end
|
data/lib/bun_bun_bundle.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative 'bun_bun_bundle/version'
|
|
4
4
|
require_relative 'bun_bun_bundle/config'
|
|
5
5
|
require_relative 'bun_bun_bundle/manifest'
|
|
6
|
+
require_relative 'bun_bun_bundle/safe_html'
|
|
6
7
|
require_relative 'bun_bun_bundle/helpers'
|
|
7
8
|
require_relative 'bun_bun_bundle/reload_tag'
|
|
8
9
|
require_relative 'bun_bun_bundle/dev_cache_middleware'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bun_bun_bundle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wout Fierens
|
|
@@ -48,6 +48,7 @@ files:
|
|
|
48
48
|
- lib/bun_bun_bundle/manifest.rb
|
|
49
49
|
- lib/bun_bun_bundle/railtie.rb
|
|
50
50
|
- lib/bun_bun_bundle/reload_tag.rb
|
|
51
|
+
- lib/bun_bun_bundle/safe_html.rb
|
|
51
52
|
- lib/bun_bun_bundle/version.rb
|
|
52
53
|
homepage: https://codeberg.org/w0u7/bun_bun_bundle
|
|
53
54
|
licenses:
|