Skip to content

npm run production and moving assets #251

Answered by robdekort
freshface asked this question in Q&A
Discussion options

You must be logged in to vote

Hey yeah, it makes sense. Make sure you reference assets like the following example in your JS/CSS files. This way Vite to updates the URL and copies the assets over to the build folder:

plugin(function({ addComponents, theme }) {
    const components = {
        '.test': {
            backgroundImage: 'url(/public/path/to/file.svg)',
        },
    }
    addComponents(components)
})

You can also reference the resources folder like this: /resources/svg/file.svg.

The config changes aren't needed this way. Hope it helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@robdekort
Comment options

Answer selected by robdekort
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