-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { glob } from "glob" | ||
import fs from "fs" | ||
import path from "path" | ||
|
||
// Define the build directory and target output | ||
const buildDir = "_site/assets" | ||
const targetFileName = "styles.css" | ||
const targetPath = path.join(buildDir, targetFileName) | ||
|
||
// Find the generated CSS file (assuming there's only one CSS file) | ||
const cssFiles = glob.sync(`${buildDir}/*.css`) | ||
|
||
if (cssFiles.length === 0) { | ||
console.error("No CSS file found in the build directory.") | ||
process.exit(0) // Exit the script | ||
} | ||
|
||
const sourceFile = cssFiles[0] // Take the first CSS file found | ||
|
||
// Copy and rename the CSS file | ||
fs.copyFileSync(sourceFile, targetPath) | ||
console.log(`CSS file '${sourceFile}' copied to: '${targetPath}'`) |