Skip to content

Commit

Permalink
Remove duplicate CSS in bundles and partials
Browse files Browse the repository at this point in the history
  • Loading branch information
qrac committed May 11, 2022
1 parent e580041 commit 048be6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "minista",
"description": "Next.js Like Development with 100% Static Generate",
"version": "2.4.3",
"version": "2.4.4",
"bin": {
"minista": "./bin/minista.js"
},
Expand Down
20 changes: 4 additions & 16 deletions src/build.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ export async function buildTempAssets(
bundleOutName: string
outDir: string
assetDir: string
generateJs: boolean
}
) {
const customConfig = defineViteConfig({
Expand All @@ -419,11 +418,6 @@ export async function buildTempAssets(
slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css"
return item?.source && fs.outputFile(customFileName, item?.source)
} else if (item.fileName.match(/__minista_bundle_assets\.js/)) {
if (buildOptions.generateJs) {
const customFileName =
slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js"
return item?.code && fs.outputFile(customFileName, item?.code)
}
return
} else {
const customFileName =
Expand Down Expand Up @@ -745,7 +739,6 @@ export async function buildPartialHydrateAssets(
bundleOutName: string
outDir: string
assetDir: string
generateJs: boolean
usePreact: boolean
}
) {
Expand Down Expand Up @@ -785,16 +778,11 @@ export async function buildPartialHydrateAssets(
if (Array.isArray(items) && items.length > 0) {
items.map((item) => {
if (item.fileName.match(/\.css/)) {
const customFileName =
slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css"
return item?.source && fs.outputFile(customFileName, item?.source)
} else if (item.fileName.match(/\.js/)) {
if (buildOptions.generateJs) {
const customFileName =
slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js"
return item?.code && fs.outputFile(customFileName, item?.code)
}
return
} else if (item.fileName.match(/\.js/)) {
const customFileName =
slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js"
return item?.code && fs.outputFile(customFileName, item?.code)
} else {
const customFileName =
buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "")
Expand Down
2 changes: 0 additions & 2 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export async function generateTempAssets(
bundleOutName: config.assets.bundle.outName,
outDir: systemConfig.temp.assets.outDir,
assetDir: config.assets.outDir,
generateJs: false,
})
await buildCopyDir(
systemConfig.temp.assets.outDir,
Expand Down Expand Up @@ -155,7 +154,6 @@ export async function generatePartialHydration(
bundleOutName: config.assets.partial.outName,
outDir: systemConfig.temp.assets.outDir,
assetDir: config.assets.outDir,
generateJs: true,
usePreact: config.assets.partial.usePreact,
})
}
Expand Down

0 comments on commit 048be6d

Please sign in to comment.