vite_rails_legacy 3.0.2 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f94fbf837fb3e2eed09ac3a9be4c2e8a040ca0905fb1298d092005e7c974804
4
- data.tar.gz: 05bb178559a0ecddf5622cfcb102f2c1f59683440f042e945160dba1a830e815
3
+ metadata.gz: 40f3eac22ded3c1aa51f8df2f9f358fd6ca22d4a161da559e5d3ce88a989ffa7
4
+ data.tar.gz: a1ecde2de7ffb38d832e88e3a35357bf36c7360c7edb7c196fa7a09582d9bf8e
5
5
  SHA512:
6
- metadata.gz: 741912fdf1576c5d6848db15e44b347dff71e7262a3385a89fb68939898946f250f056b64a305a1035eb7ff7e5d03f1732af87c89cfcbe6b75747dea4997e367
7
- data.tar.gz: 62d2ea796b9e6ef36d55e39f83839b6c7cf57895d7553ae94678de2b5d78557b86e3e2386177a13399faaf463f51a734f8607e9a4a103d06476a3204550dc5f4
6
+ metadata.gz: c7ea3513568e709000f49ae9bebcb810accb1155017a3543e1af741887a3841c21c98485957066da0afac75a00332f1114b308dc0c92bb0b749cc88a8c4049c6
7
+ data.tar.gz: 66f7ebc27e416121c9ff6dc7036f3100ebacb23a829bbcca818bf1f3df2e1f258e0b7e068534808c2bac1fa4bdbc4ea343bbae3d420f796f1847f10385382325
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [3.0.5](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.4...vite_rails_legacy@3.0.5) (2022-04-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * add vite_asset_url helper ([#208](https://github.com/ElMassimo/vite_ruby/issues/208)) ([d269793](https://github.com/ElMassimo/vite_ruby/commit/d2697934b5a866ea5b14588b650a00dfe88454a3))
7
+
8
+
9
+
10
+ ## [3.0.4](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.3...vite_rails_legacy@3.0.4) (2022-04-14)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * prevent error when using a proc in asset_host (close [#202](https://github.com/ElMassimo/vite_ruby/issues/202)) ([#203](https://github.com/ElMassimo/vite_ruby/issues/203)) ([cb23a81](https://github.com/ElMassimo/vite_ruby/commit/cb23a81037651ac01d993935f68cc526ec2c844d))
16
+ * update example setup from turbolinks to @hotwired/turbo ([e1750bf](https://github.com/ElMassimo/vite_ruby/commit/e1750bfb4b22a9a73a2b86950fb203d3e489ced6))
17
+
18
+
19
+
20
+ ## [3.0.3](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.2...vite_rails_legacy@3.0.3) (2021-12-23)
21
+
22
+
23
+
1
24
  ## [3.0.2](https://github.com/ElMassimo/vite_ruby/compare/vite_rails_legacy@3.0.1...vite_rails_legacy@3.0.2) (2021-12-12)
2
25
 
3
26
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">
2
2
  <a href="https://vite-ruby.netlify.app/">
3
- <img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/docs/public/logo.svg" width="120px"/>
3
+ <img src="https://raw.githubusercontent.com/ElMassimo/vite_ruby/main/logo.svg" width="120px"/>
4
4
  </a>
5
5
 
6
6
  <br>
@@ -4,8 +4,9 @@ module ViteRailsLegacy::Config
4
4
  # Override: Default values for a Rails application.
5
5
  def config_defaults
6
6
  require 'rails'
7
+ asset_host = Rails.application&.config&.action_controller&.asset_host
7
8
  super(
8
- asset_host: Rails.application&.config&.action_controller&.asset_host,
9
+ asset_host: asset_host.is_a?(Proc) ? nil : asset_host,
9
10
  mode: Rails.env.to_s,
10
11
  root: Rails.root || Dir.pwd,
11
12
  )
@@ -22,6 +22,14 @@ module ViteRailsLegacy::TagHelpers
22
22
  path_to_asset vite_manifest.path_for(name, **options)
23
23
  end
24
24
 
25
+ # Public: Resolves the url for the specified Vite asset.
26
+ #
27
+ # Example:
28
+ # <%= vite_asset_url 'calendar.css' %> # => "https://example.com/vite/assets/calendar-1016838bab065ae1e122.css"
29
+ def vite_asset_url(name, **options)
30
+ url_to_asset vite_manifest.path_for(name, **options)
31
+ end
32
+
25
33
  # Public: Renders a <script> tag for the specified Vite entrypoints.
26
34
  def vite_javascript_tag(*names,
27
35
  type: 'module',
@@ -49,6 +57,17 @@ module ViteRailsLegacy::TagHelpers
49
57
  stylesheet_link_tag(*style_paths, **options)
50
58
  end
51
59
 
60
+ # Public: Renders an <img> tag for the specified Vite asset.
61
+ def vite_image_tag(name, **options)
62
+ if options[:srcset] && !options[:srcset].is_a?(String)
63
+ options[:srcset] = options[:srcset].map do |src_name, size|
64
+ "#{ vite_asset_path(src_name) } #{ size }"
65
+ end.join(', ')
66
+ end
67
+
68
+ image_tag(vite_asset_path(name), options)
69
+ end
70
+
52
71
  private
53
72
 
54
73
  # Internal: Returns the current manifest loaded by Vite Ruby.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViteRailsLegacy
4
- VERSION = '3.0.2'
4
+ VERSION = '3.0.5'
5
5
  end
@@ -15,16 +15,14 @@ console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify
15
15
 
16
16
  // Example: Load Rails libraries in Vite.
17
17
  //
18
- // import '@rails/ujs'
18
+ // import * as Turbo from '@hotwired/turbo'
19
+ // Turbo.start()
19
20
  //
20
- // import Turbolinks from 'turbolinks'
21
21
  // import ActiveStorage from '@rails/activestorage'
22
+ // ActiveStorage.start()
22
23
  //
23
24
  // // Import all channels.
24
25
  // const channels = import.meta.globEager('./**/*_channel.js')
25
- //
26
- // Turbolinks.start()
27
- // ActiveStorage.start()
28
26
 
29
27
  // Example: Import a stylesheet in app/frontend/index.css
30
28
  // import '~/index.css'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_rails_legacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-12 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -61,8 +61,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
61
61
  licenses:
62
62
  - MIT
63
63
  metadata:
64
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@3.0.2/vite_rails_legacy
65
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@3.0.2/vite_rails_legacy/CHANGELOG.md
64
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_rails_legacy@3.0.5/vite_rails_legacy
65
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_rails_legacy@3.0.5/vite_rails_legacy/CHANGELOG.md
66
66
  post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 3.1.4
81
+ rubygems_version: 3.2.32
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Use Vite in Rails 4 and bring joy to your JavaScript experience