mirror of
https://github.com/NohamR/oled-nnw.git
synced 2026-05-26 04:17:19 +00:00
chore: unocss setup
This commit is contained in:
29
uno.config.ts
Normal file
29
uno.config.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import fs from 'node:fs'
|
||||
import { defineConfig } from 'unocss'
|
||||
import { DIRECTORY_NAME } from './constant'
|
||||
|
||||
function getMainCss() {
|
||||
const env = process.env.NODE_ENV
|
||||
const input = fs.readFileSync('main.css', 'utf8')
|
||||
if (env === 'development')
|
||||
return input
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
||||
const CleanCSS = require('clean-css')
|
||||
return new CleanCSS().minify(input).styles
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
cli: {
|
||||
entry: {
|
||||
patterns: [`${DIRECTORY_NAME}/template.html`],
|
||||
outFile: `${DIRECTORY_NAME}/stylesheet.css`,
|
||||
},
|
||||
},
|
||||
|
||||
preflights: [
|
||||
{
|
||||
layer: 'my-style',
|
||||
getCSS: () => getMainCss(),
|
||||
},
|
||||
],
|
||||
})
|
||||
Reference in New Issue
Block a user