Skip to content

How do I load only certain js files from a specific html.erb? #339

Answered by ElMassimo
sandonemaki asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there!

Although the guide uses tag helpers in application.html.erb because that's the most common, you can instead use them inside views to load scripts as needed.

For example, in index.html.erb:

<%= vite_javascript_tag "index" %>

will render a script tag, which would load entrypoints/index.js.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sandonemaki
Comment options

@ElMassimo
Comment options

@sandonemaki
Comment options

Answer selected by ElMassimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants