diff --git a/src/commands/theme/component/install.ts b/src/commands/theme/component/install.ts
index 4894a8f..f92ee2d 100644
--- a/src/commands/theme/component/install.ts
+++ b/src/commands/theme/component/install.ts
@@ -4,7 +4,7 @@
* - Maps the components in the theme directory
* - Copies rendered component files (snippets and assets) into the theme directory
* - Cleans up unnecessary component files in the theme directory
- * - Generates an import-map.liquid snippet file based on JS assets
+ * - Generates a head.import-map.liquid snippet file based on JS assets
*/
import Args from '../../../utilities/args.js'
diff --git a/src/commands/theme/generate/import-map.ts b/src/commands/theme/generate/import-map.ts
index ecc4674..bf60f66 100644
--- a/src/commands/theme/generate/import-map.ts
+++ b/src/commands/theme/generate/import-map.ts
@@ -3,7 +3,7 @@
*
* - Reads all JS files in the assets directory
* - Creates an import map object with the asset URLs
- * - Writes the import map to snippets/import-map.liquid
+ * - Writes the import map to snippets/head.import-map.liquid
*/
import * as fs from 'node:fs'
@@ -50,15 +50,15 @@ export default class GenerateImportMap extends BaseCommand {
)
}
- // Write the import map to snippets/import-map.liquid
+ // Write the import map to snippets/head.import-map.liquid
const importMapContent = ``
- const importMapPath = path.join(snippetsDir, 'import-map.liquid')
+ const importMapPath = path.join(snippetsDir, 'head.import-map.liquid')
if (!fs.existsSync(importMapPath) || fs.readFileSync(importMapPath, 'utf8') !== importMapContent) {
fs.writeFileSync(importMapPath, importMapContent)
}
if (!this.flags[Flags.QUIET]) {
- this.log('Successfully generated import map at snippets/import-map.liquid')
+ this.log('Successfully generated import map at snippets/head.import-map.liquid')
}
}
}
diff --git a/test/commands/theme/generate/import-map.test.ts b/test/commands/theme/generate/import-map.test.ts
index 8af518e..85d89c2 100644
--- a/test/commands/theme/generate/import-map.test.ts
+++ b/test/commands/theme/generate/import-map.test.ts
@@ -22,10 +22,10 @@ describe('theme generate import-map', () => {
it('generates empty import map when no JS files exist', async () => {
await runCommand(['theme:generate:import-map', testThemePath])
-
- const importMapPath = path.join(testThemePath, 'snippets', 'import-map.liquid')
+
+ const importMapPath = path.join(testThemePath, 'snippets', 'head.import-map.liquid')
const content = fs.readFileSync(importMapPath, 'utf8')
-
+
const jsonContent = extractImportMapJson(content)
expect(jsonContent).to.deep.equal({
imports: {}
@@ -36,12 +36,12 @@ describe('theme generate import-map', () => {
const assetsPath = path.join(testThemePath, 'assets')
fs.writeFileSync(path.join(assetsPath, 'main.js'), '')
fs.writeFileSync(path.join(assetsPath, 'utils.js'), '')
-
+
await runCommand(['theme:generate:import-map', testThemePath])
-
- const importMapPath = path.join(testThemePath, 'snippets', 'import-map.liquid')
+
+ const importMapPath = path.join(testThemePath, 'snippets', 'head.import-map.liquid')
const content = fs.readFileSync(importMapPath, 'utf8')
-
+
const jsonContent = extractImportMapJson(content)
expect(jsonContent).to.deep.equal({
imports: {
@@ -54,12 +54,12 @@ describe('theme generate import-map', () => {
it('does not include .min in the entry key', async () => {
const assetsPath = path.join(testThemePath, 'assets')
fs.writeFileSync(path.join(assetsPath, 'component.min.js'), '')
-
+
await runCommand(['theme:generate:import-map', testThemePath])
-
- const importMapPath = path.join(testThemePath, 'snippets', 'import-map.liquid')
+
+ const importMapPath = path.join(testThemePath, 'snippets', 'head.import-map.liquid')
const content = fs.readFileSync(importMapPath, 'utf8')
-
+
const jsonContent = extractImportMapJson(content)
expect(jsonContent).to.deep.equal({
imports: {
@@ -90,12 +90,12 @@ describe('theme generate import-map', () => {
it('updates existing import map', async () => {
const assetsPath = path.join(testThemePath, 'assets')
fs.writeFileSync(path.join(assetsPath, 'main.js'), '')
- const importMapPath = path.join(testThemePath, 'snippets', 'import-map.liquid')
+ const importMapPath = path.join(testThemePath, 'snippets', 'head.import-map.liquid')
const initialContent = ``
fs.writeFileSync(importMapPath, initialContent)
await runCommand(['theme:generate:import-map', testThemePath])
-
+
const content = fs.readFileSync(importMapPath, 'utf8')
const jsonContent = extractImportMapJson(content)
expect(jsonContent).to.deep.equal({