nitro icon indicating copy to clipboard operation
nitro copied to clipboard

feature: Add an utility to add assets to routes

Open RodrigoProjects opened this issue 1 month ago • 0 comments

Describe the feature

Currently we can add public assets directories but not individual files which seems straight forward to add improving DX along the way.

My suggestion is creating a addPublicAsset(pathToAFile), would be interesting to support public asset hashing at build time too:

  • If I do a fetch in my application for /something/publicAsset.png it coud be doable to replace this string in build time with an hashing file like /something/32eqedqdqw.publicAsset.png but I really could be seeing it wrongly here!

Use case:

  • I need a way to add public assets without creating a temporary dir each time and hashing it based on the content.
  • I am creating a way to dynamically import tailwind css file in nuxt/tailwind module and need a pratical way to add the new asset in a nuxt module and hash it if possible.

Additional information

  • [x] Would you be willing to help implement this feature?

RodrigoProjects avatar Jun 03 '24 12:06 RodrigoProjects