Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

[doc] Add how to use assets with dynamic names#6635

Closed
tobiasdiez wants to merge 1 commit intonuxt:mainfrom
tobiasdiez:patch-1
Closed

[doc] Add how to use assets with dynamic names#6635
tobiasdiez wants to merge 1 commit intonuxt:mainfrom
tobiasdiez:patch-1

Conversation

@tobiasdiez
Copy link
Copy Markdown
Contributor

🔗 Linked issue

Based on nuxt/nuxt#12797

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Add how to dynamically link assets.
Caveat: It doesn't work using the syntax ~/assets/... instead of /assets/..., and it sadly doesn't work in production. So I guess I'm missing something.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link
Copy Markdown

netlify bot commented Aug 15, 2022

Deploy Preview for nuxt3-docs ready!

Name Link
🔨 Latest commit 54ea491
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/62fa3658a541e40008052f81
😎 Deploy Preview https://deploy-preview-6635--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Aareksio
Copy link
Copy Markdown

/assets being available in dev is a Vite quirk. Adding this to documentation is misleading. That said, documentation could use an example of how to use dynamic imports from assets to replace require(`~/assets/{name}`) from the old days.

@pi0
Copy link
Copy Markdown
Member

pi0 commented Aug 22, 2022

@tobiasdiez Can you please open a new issue with reproduction? We might try to investigate and fix support for dynamic assets. (But generally you can always use public/ directory too)

@tobiasdiez
Copy link
Copy Markdown
Contributor Author

@pi0 Done: nuxt/nuxt#14766!

The public folder works in some situation, but not if you want to have some optimization etc going on during the build process.

@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants