Skip to content

Commit

Permalink
feat: added disable theme check tag on the generated snippet
Browse files Browse the repository at this point in the history
By default the generated snippet has some warnings "Asset should be served by the Shopify CDN for better performance." appending this on top of the file will disable the warnings that might block potential theme check CI/CD.
  • Loading branch information
blanklob committed Aug 17, 2024
1 parent 2ee0f6e commit cfa29e4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vite-plugin-shopify/src/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default function shopifyHTML (options: Required<Options>): Plugin {
debug({ address, viteDevServerUrl })

const reactPlugin = config.plugins.find(plugin => plugin.name === 'vite:react-babel' || plugin.name === 'vite:react-refresh')

const viteTagSnippetContent = viteTagDisclaimer + viteTagEntryPath(config.resolve.alias, options.entrypointsDir, viteTagSnippetName) + viteTagSnippetDev(viteDevServerUrl, options.entrypointsDir, reactPlugin)

// Write vite-tag snippet for development server
fs.writeFileSync(viteTagSnippetPath, viteTagSnippetContent)
}
Expand Down Expand Up @@ -141,7 +141,8 @@ export default function shopifyHTML (options: Required<Options>): Plugin {
}
}

const viteTagDisclaimer = '{% comment %}\n IMPORTANT: This snippet is automatically generated by vite-plugin-shopify.\n Do not attempt to modify this file directly, as any changes will be overwritten by the next build.\n{% endcomment %}\n'
const disableThemeCheckTag = '{% # theme-check-disable %}\n'
const viteTagDisclaimer = `${disableThemeCheckTag}{% comment %}\n IMPORTANT: This snippet is automatically generated by vite-plugin-shopify.\n Do not attempt to modify this file directly, as any changes will be overwritten by the next build.\n{% endcomment %}\n`

// Generate liquid variable with resolved path by replacing aliases
const viteTagEntryPath = (
Expand Down

0 comments on commit cfa29e4

Please sign in to comment.