forked from vitejs/vite
-
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
1 parent
627a52c
commit e56418d
Showing
15 changed files
with
190 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { isBuild, editFile, untilUpdated, getColor } from '../../testUtils' | ||
|
||
test('should render', async () => { | ||
expect(await page.textContent('#pagetitle')).toBe('|Page title|') | ||
}) | ||
|
||
if (!isBuild) { | ||
test('regenerate CSS and HMR', async () => { | ||
browserLogs.length = 0 | ||
const el = await page.$('#pagetitle') | ||
const el2 = await page.$('#helloroot') | ||
|
||
expect(await getColor(el)).toBe('rgb(11, 22, 33)') | ||
|
||
editFile('src/views/Page.vue', (code) => | ||
code.replace('|Page title|', '|Page title updated|') | ||
) | ||
await untilUpdated(() => el.textContent(), '|Page title updated|') | ||
|
||
expect(browserLogs).toMatchObject([ | ||
'[vite] css hot updated: /index.css', | ||
'[vite] hot updated: /src/views/Page.vue' | ||
]) | ||
|
||
browserLogs.length = 0 | ||
|
||
editFile('src/components/HelloWorld.vue', (code) => | ||
code.replace('text-gray-800', 'text-[rgb(10,20,30)]') | ||
) | ||
|
||
await untilUpdated(() => getColor(el2), 'rgb(10, 20, 30)') | ||
|
||
expect(browserLogs).toMatchObject([ | ||
'[vite] css hot updated: /index.css', | ||
'[vite] hot updated: /src/components/HelloWorld.vue' | ||
]) | ||
|
||
browserLogs.length = 0 | ||
}) | ||
} |
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,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
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,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
<link rel="stylesheet" href="./index.css" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></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,21 @@ | ||
{ | ||
"name": "test-tailwind", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"debug": "node --inspect-brk ../../vite/bin/vite", | ||
"serve": "vite preview" | ||
}, | ||
"dependencies": { | ||
"autoprefixer": "^10.3.0", | ||
"tailwindcss": "^2.2.4", | ||
"vue": "^3.0.8" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^1.0.0", | ||
"@vue/compiler-sfc": "^3.0.8", | ||
"vue-router": "^4.0.10" | ||
} | ||
} |
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,7 @@ | ||
// postcss.config.js | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: { config: __dirname + '/tailwind.config.js' }, | ||
autoprefixer: {} | ||
} | ||
} |
Binary file not shown.
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 @@ | ||
<template> | ||
<div> | ||
<h1>Tailwind app</h1> | ||
{{ foo }} | ||
</div> | ||
<router-view /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const foo = ref(42); | ||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
<template> | ||
<div id="helloroot" class="bg-red-400 text-gray-800">HelloWorld - {{ count }}</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const count = 1; | ||
</script> |
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,6 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
// import '../index.css'; | ||
|
||
createApp(App).use(router).mount('#app') |
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,16 @@ | ||
import { createWebHistory, createRouter } from 'vue-router' | ||
import Page from './views/Page.vue' | ||
|
||
const history = createWebHistory() | ||
|
||
const routeur = createRouter({ | ||
history: history, | ||
routes: [ | ||
{ | ||
path: '/', | ||
component: Page | ||
} | ||
] | ||
}) | ||
|
||
export default routeur |
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,26 @@ | ||
<template> | ||
<div> | ||
<h1 id="pagetitle" class="text-[rgb(11,22,33)] text-2xl">|Page title|</h1> | ||
<div @click="val = val+1">{{ val }}</div> | ||
<div class="bg-red-100 inline-block h-24 px-8 mb-8 text-[#888888]">Tailwind style</div> | ||
<HelloWorld /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, ref } from 'vue'; | ||
import HelloWorld from '../components/HelloWorld.vue'; | ||
export default defineComponent({ | ||
components: { HelloWorld }, | ||
setup() { | ||
const val = ref(0); | ||
return { | ||
val | ||
} | ||
} | ||
}); | ||
</script> |
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 @@ | ||
module.exports = { | ||
mode: 'jit', | ||
purge: [__dirname + '/src/**/*.vue'], | ||
darkMode: false, // or 'media' or 'class' | ||
theme: { | ||
extend: {} | ||
}, | ||
variants: { | ||
extend: {} | ||
}, | ||
plugins: [] | ||
} |
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,15 @@ | ||
import { defineConfig } from 'vite' | ||
import vue from '@vitejs/plugin-vue' | ||
|
||
export default defineConfig({ | ||
resolve: { | ||
alias: { | ||
'/@': __dirname | ||
} | ||
}, | ||
plugins: [vue()], | ||
build: { | ||
// to make tests faster | ||
minify: false | ||
} | ||
}) |
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