Vite plugin to watch and copy static assets (e.g., fonts, images, static JS/CSS) into a Shopify theme's assets folder during development and build. Version 1.0.0 is the first stable release, compatible with Vite 5 and 6 and Node 18–22. It works alongside vite-plugin-shopify, but can be used standalone. The plugin copies files from a public directory to the theme's assets folder, supports glob patterns, ignore filters, custom destinations, and rename functions for generating Liquid snippets from SVGs. It keeps the assets folder in sync on dev, watch, and build, ensuring that static assets are available in Shopify without manual copying.
npm install vite-plugin-shopify-assetsVerified import paths — ran on the pinned version, not inferred.
Basic setup to sync public/ folder assets to theme assets/ folder with vite-plugin-shopify and vite-plugin-shopify-assets.
Set the 'publicDir' option in shopifyAssets() to match your Vite publicDir value.
Always make dest relative to themeRoot. For example, 'assets/fonts' becomes 'fonts' if themeRoot is the root.
Test your rename function with sample files and log the arguments to understand the structure.
Import only from 'vite-plugin-shopify-assets' which exports the plugin function and types.
Create a public/ directory or set the 'publicDir' option in the plugin to an existing directory.
Install with npm i -D vite-plugin-shopify-assets and use ES import syntax.
Use default import: import shopifyAssets from 'vite-plugin-shopify-assets'.