module LuckyVite::Tags

Direct including types

Defined in:

lucky_vite/tags.cr

Constant Summary

SERVED_BY_VITE = ["js", "jsx", "ts", "tsx", "css", "scss", "less"] of ::String

Macro Summary

Instance Method Summary

Macro Detail

macro asset(entry) #

Loads an asset from the vite server in development or as a static file in production.


[View source]
macro dynamic_asset(entry) #

Loads an asset, without checking it's existance in the manifest, from the vite server in development or as a static file in production.


[View source]
macro vite_css_link(entry, **options) #

Generates a stylesheet link tag for the given entrypoint.

Additional tag attributes can be passed in as named arguments.


[View source]
macro vite_entry_tags(entry, **options) #

A one-stop shop for all your vite tags in development and production.

Additional tag attributes can be passed in as named arguments.

Note: in development this method connects with the vite server; in other environments it loads compiled files from the manifest.


[View source]
macro vite_js_link(entry, **options) #

Generates a script tag for the given entrypoint.

Additional tag attributes can be passed in as named arguments.


[View source]

Instance Method Detail

def vite_client_tag(**options) #

Renders the Vite client to enable Hot Module Reload in development.


[View source]
def vite_react_refresh_tag(**options) #

Loads /@react-refresh from the vite server and renders a script tag with the refresh hook.

# In a page or component:
vite_react_refresh_tag

Only use this tag with @vitejs/plugin-react.


[View source]