Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vite): does not found CSS placeholder in the generated chunks (#1400
- Loading branch information
Showing
8 changed files
with
153 additions
and
18 deletions.
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
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,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
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,8 @@ | ||
.foo { | ||
@apply flex; | ||
@apply gap-1; | ||
} | ||
|
||
.bar { | ||
--at-apply: gap-2; | ||
} |
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,19 @@ | ||
import '@unocss/reset/tailwind.css' | ||
import './main.css' | ||
import 'uno.css' | ||
|
||
// @unocss-include | ||
const html = String.raw | ||
document.querySelector<HTMLDivElement>('#app')!.innerHTML = html` | ||
<div class="font-sans p4"> | ||
<p class="text-red"> | ||
Red | ||
</p> | ||
<p class=":uno: text-green text-xl"> | ||
Green Large | ||
</p> | ||
<p class="text-(blue sm)"> | ||
Blue Small | ||
</p> | ||
</div> | ||
` |
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,8 @@ | ||
{ | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build" | ||
} | ||
} |
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 { | ||
defineConfig, | ||
presetAttributify, | ||
presetIcons, | ||
presetUno, | ||
transformerCompileClass, | ||
transformerDirectives, | ||
transformerVariantGroup, | ||
} from 'unocss' | ||
|
||
export default defineConfig({ | ||
presets: [ | ||
presetAttributify(), | ||
presetUno(), | ||
presetIcons(), | ||
], | ||
transformers: [ | ||
transformerCompileClass(), | ||
transformerVariantGroup(), | ||
transformerDirectives(), | ||
], | ||
}) |
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,23 @@ | ||
import { resolve } from 'path' | ||
import { defineConfig } from 'vite' | ||
import UnoCSS from '@unocss/vite' | ||
|
||
export default defineConfig({ | ||
build: { | ||
lib: { | ||
entry: resolve(__dirname, 'lib/main.ts'), | ||
name: 'MyLib', | ||
fileName: 'my-lib', | ||
formats: [ | ||
'cjs', | ||
'es', | ||
'iife', | ||
'umd', | ||
], | ||
}, | ||
cssCodeSplit: true, | ||
}, | ||
plugins: [ | ||
UnoCSS(), | ||
], | ||
}) |