Build CSS using Vite

This commit is contained in:
Nikita Karamov 2023-01-25 18:27:00 +01:00
parent ae67a19233
commit 1550573923
No known key found for this signature in database
GPG Key ID: 41D6F71EE78E77CD
4 changed files with 9 additions and 5 deletions

View File

@ -22,7 +22,6 @@
}
</style>
<link rel="stylesheet" href="./src/shareon.css" />
</head>
<body>

View File

@ -42,9 +42,7 @@
"dist"
],
"scripts": {
"build": "pnpm run build:js && pnpm run build:css",
"build:js": "vite build",
"build:css": "postcss src/shareon.css -o dist/shareon.min.css --map",
"build": "vite build",
"dev": "vite",
"lint": "prettier --check . && eslint .",
"size": "size-limit",
@ -63,7 +61,6 @@
"postcss": "^8.4.19",
"postcss-banner": "^4.0.1",
"postcss-calc": "^8.2.4",
"postcss-cli": "^10.0.0",
"postcss-css-variables": "^0.18.0",
"postcss-csso": "^6.0.1",
"prettier": "^2.7.1",

View File

@ -1,3 +1,5 @@
import "./shareon.css";
// prettier-ignore
/**
* Map of social networks to their respective URL builders.

View File

@ -15,6 +15,12 @@ export default defineConfig({
},
rollupOptions: {
output: {
// Workaround for a correct file name
// See: https://github.com/vitejs/vite/issues/4863
assetFileNames: (assetInfo) => {
if (assetInfo.name === "style.css") return "shareon.min.css";
return assetInfo.name;
},
banner: `/*! ${package_.name} v${package_.version} */`,
},
},