Skip to content

Commit b85193b

Browse files
committed
chore: prepare for webpack test case
1 parent abd7284 commit b85193b

File tree

11 files changed

+780
-207
lines changed

11 files changed

+780
-207
lines changed

packages/unplugin-tailwindcss-mangle/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@
8282
},
8383
"devDependencies": {
8484
"@types/micromatch": "^4.0.2",
85+
"css-loader": "^6.8.1",
86+
"html-webpack-plugin": "^5.5.3",
87+
"mini-css-extract-plugin": "^2.7.6",
88+
"postcss": "^8.4.24",
89+
"postcss-loader": "^7.3.3",
8590
"simple-functional-loader": "^1.2.1",
8691
"tailwindcss": "^3.3.2",
8792
"tslib": "^2.5.3",

packages/unplugin-tailwindcss-mangle/test/__snapshots__/vite.test.ts.snap

Lines changed: 486 additions & 3 deletions
Large diffs are not rendered by default.

packages/unplugin-tailwindcss-mangle/test/fixtures/vite-repo/tailwind.config.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ module.exports = {
77
extend: {},
88
},
99
plugins: [],
10+
corePlugins: {
11+
preflight: false
12+
}
1013
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
plugins: {
5+
tailwindcss: {
6+
config: path.resolve(__dirname, './tailwind.config.js')
7+
},
8+
// autoprefixer: {},
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
10+
<body>
11+
<div class="bg-[#123456]">bg-[#123456]</div>
12+
<div id="app"></div>
13+
</body>
14+
15+
</html>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import 'index.css'
2+
3+
document.querySelector('#app').innerHTML = `
4+
<main class="flex min-h-screen flex-col items-center justify-between p-24">
5+
<div class="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
6+
<p
7+
class="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
8+
Get started by editing&nbsp;
9+
<code class="font-mono font-bold">pages/index.tsx</code>
10+
</p>
11+
<div
12+
class="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
13+
<a class="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
14+
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
15+
target="_blank" rel="noopener noreferrer">
16+
By
17+
</a>
18+
</div>
19+
</div>
20+
21+
<div
22+
class="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700/10 after:dark:from-sky-900 after:dark:via-[#0141ff]/40 before:lg:h-[360px]">
23+
<img class="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert" src="/vite.svg" alt="Next.js Logo"
24+
priority />
25+
</div>
26+
27+
<div class="mb-32 grid text-center lg:mb-0 lg:grid-cols-4 lg:text-left">
28+
<a href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
29+
class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
30+
target="_blank" rel="noopener noreferrer">
31+
<h2 class="mb-3 text-2xl font-semibold">
32+
Docs <span
33+
class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-&gt;</span>
34+
</h2>
35+
<p class="m-0 max-w-[30ch] text-sm opacity-50">Find in-depth information about Next.js
36+
features and API.</p>
37+
</a>
38+
39+
<a href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
40+
class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
41+
target="_blank" rel="noopener noreferrer">
42+
<h2 class="mb-3 text-2xl font-semibold">
43+
Learn <span
44+
class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-&gt;</span>
45+
</h2>
46+
<p class="m-0 max-w-[30ch] text-sm opacity-50">Learn about Next.js in an interactive
47+
course with&nbsp;quizzes!</p>
48+
</a>
49+
50+
<a href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
51+
class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
52+
target="_blank" rel="noopener noreferrer">
53+
<h2 class="mb-3 text-2xl font-semibold">
54+
Templates <span
55+
class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-&gt;</span>
56+
</h2>
57+
<p class="m-0 max-w-[30ch] text-sm opacity-50">Discover and deploy boilerplate example
58+
Next.js&nbsp;projects.</p>
59+
</a>
60+
61+
<a href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
62+
class="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
63+
target="_blank" rel="noopener noreferrer">
64+
<h2 class="mb-3 text-2xl font-semibold">
65+
Deploy <span
66+
class="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">-&gt;</span>
67+
</h2>
68+
<p class="m-0 max-w-[30ch] text-sm opacity-50">Instantly deploy your Next.js site to a
69+
shareable URL with Vercel.</p>
70+
</a>
71+
</div>
72+
</main>
73+
`
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const path = require('path')
2+
3+
/** @type {import('tailwindcss').Config} */
4+
module.exports = {
5+
content: [path.resolve(__dirname, "./src/**/*.{html,js,ts}")],
6+
theme: {
7+
extend: {},
8+
},
9+
plugins: [],
10+
corePlugins: {
11+
preflight: false
12+
}
13+
}

packages/unplugin-tailwindcss-mangle/test/vite.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ describe('vite build', () => {
1414
const res = (await build({
1515
root: path.resolve(__dirname, 'fixtures/vite-repo'),
1616
build: {
17-
write: false
17+
write: false,
18+
cssMinify: false
1819
},
1920
plugins: [utwm()]
2021
})) as RollupOutput

packages/unplugin-tailwindcss-mangle/test/webpack.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import webpack from 'webpack'
22
import { describe, it, expect } from 'vitest'
3-
3+
import path from 'node:path'
44
describe('webpack build', () => {
55
it('common', () => {
6-
expect(true).toBe(true)
6+
const compiler = webpack(
7+
{
8+
mode: 'production',
9+
entry: ['./index.js'],
10+
context: path.resolve(__dirname, 'fixtures/webpack-repo')
11+
},
12+
(err, stats) => {}
13+
)
714
})
815
// webpack({}, (err, stats) => {
916
// if (err || stats.hasErrors()) {

0 commit comments

Comments
 (0)