Skip to content

Commit

Permalink
feat: init wcmw.bar
Browse files Browse the repository at this point in the history
  • Loading branch information
imantsk committed Nov 21, 2024
1 parent c179689 commit 44304da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"dev": "vite",
"build": "vite build"
"build": "vite build && node scripts/css.mjs"
},
"keywords": [],
"author": "",
Expand Down
22 changes: 22 additions & 0 deletions scripts/css.mjs
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}'`)

0 comments on commit 44304da

Please sign in to comment.