vite-plugin-spine-dynamic-url
v1.0.0
Published
Automatically corrects the image path in specified spine atlas files
Downloads
1
Maintainers
Readme
vite-spine-dynamic-url
This plugin automatically replaces the URL of images in the atlas file with the dynamic url of the image generated by Vite.
Why
When using Spine in Vite, the URL of the image in the atlas file is not replaced with a dynamic URL, which will cause the image to fail to load.
Install
npm i vite-spine-dynamic-url --save-dev
Usage
Configure the plugin in vite.config.js
:
// vite.config.js
import spineDynamicUrl from 'vite-spine-dynamic-url'
export default {
plugins: [
atlasDynamicUrl({ atlasInclude: "src/spines/**/*.atlas" }),
]
}
When loading a Spine data you should import it using the import
or URL syntax so Vite can handle the .json
name hashing.
More info about that can be found here.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.