diff options
author | 2021-03-24 11:45:38 -0400 | |
---|---|---|
committer | 2021-03-24 11:45:38 -0400 | |
commit | 3c24faa8cab428b17ba2f8e083f5296b1b931fe1 (patch) | |
tree | 940e2b6b68c2d7e895802fd451c7777f60c56eb6 /src/generate.ts | |
parent | 5c1cd5b1da446f51e535030072756126f7b038d7 (diff) | |
download | astro-3c24faa8cab428b17ba2f8e083f5296b1b931fe1.tar.gz astro-3c24faa8cab428b17ba2f8e083f5296b1b931fe1.tar.zst astro-3c24faa8cab428b17ba2f8e083f5296b1b931fe1.zip |
hmx ☞ astro (#22)
This changes all hmx files to astro files and updates all code to not reference hmx any more.
Diffstat (limited to 'src/generate.ts')
-rw-r--r-- | src/generate.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/generate.ts b/src/generate.ts index 225bf4fde..4a31cc291 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -19,8 +19,8 @@ async function* allPages(root: URL): AsyncGenerator<URL, void, unknown> { } export default async function (astroConfig: AstroConfig) { - const { projectRoot, hmxRoot } = astroConfig; - const pageRoot = new URL('./pages/', hmxRoot); + const { projectRoot, astroRoot } = astroConfig; + const pageRoot = new URL('./pages/', astroRoot); const dist = new URL(astroConfig.dist + '/', projectRoot); const configPath = new URL('./snowpack.config.js', projectRoot).pathname; @@ -39,11 +39,11 @@ export default async function (astroConfig: AstroConfig) { const runtime = snowpack.getServerRuntime(); for await (const filepath of allPages(pageRoot)) { - const rel = pathRelative(hmxRoot.pathname, filepath.pathname); // pages/index.hmx - const pagePath = `/_hmx/${rel.replace(/\.(hmx|md)/, '.js')}`; + const rel = pathRelative(astroRoot.pathname, filepath.pathname); // pages/index.astro + const pagePath = `/_astro/${rel.replace(/\.(astro|md)/, '.js')}`; try { - const outPath = new URL('./' + rel.replace(/\.(hmx|md)/, '.html'), dist); + const outPath = new URL('./' + rel.replace(/\.(astro|md)/, '.html'), dist); const outFolder = new URL('./', outPath); const mod = await runtime.importModule(pagePath); const html = await mod.exports.default({}); |