132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/jekyll/vite/tags.rb', line 132
def render(context)
super {
media = @params.delete(:media) || 'screen'
crossorigin = @params.delete(:crossorigin) || 'anonymous'
type = @params.delete(:type) || 'module'
asset_type = @tag_name == 'vite_typescript_tag' ? :typescript : :javascript
entries = vite_manifest.resolve_entries(@file, type: asset_type)
[
script_tags(entries.fetch(:scripts), crossorigin: crossorigin, type: type, **@params),
link_tags(entries.fetch(:imports), rel: 'modulepreload', as: 'script', crossorigin: crossorigin, **@params),
link_tags(entries.fetch(:stylesheets), rel: 'stylesheet', media: media, crossorigin: crossorigin, **@params),
].join("\n")
}
end
|