Skip to content

Commit 57b600c

Browse files
committed
feat: add tailwindcss with CSS extract plugin example
1 parent e9433ea commit 57b600c

File tree

13 files changed

+124
-7
lines changed

13 files changed

+124
-7
lines changed

pnpm-lock.yaml

Lines changed: 45 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rspack/generate-package-json-webpack-plugin@2/package.json renamed to rspack/generate-package-json-webpack-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@rspack-example/generate-package-json-webpack-plugin_2",
2+
"name": "@rspack-example/generate-package-json-webpack-plugin",
33
"private": true,
44
"scripts": {
55
"build": "rspack build"

rspack/generate-package-json-webpack-plugin@2/rspack.config.js renamed to rspack/generate-package-json-webpack-plugin/rspack.config.js

File renamed without changes.

rspack/generate-package-json-webpack-plugin@2/src/index.js renamed to rspack/generate-package-json-webpack-plugin/src/index.js

File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
</body>
12+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@rspack-example/tailwindcss-with-type-css",
3+
"version": "1.0.0",
4+
"private": true,
5+
"license": "MIT",
6+
"type": "module",
7+
"scripts": {
8+
"build": "rspack build",
9+
"dev": "rspack dev"
10+
},
11+
"devDependencies": {
12+
"@rspack/cli": "1.7.4",
13+
"@rspack/core": "1.7.4",
14+
"@tailwindcss/webpack": "^4.2.1",
15+
"tailwindcss": "^4.2.1"
16+
}
17+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// @ts-check
2+
import { defineConfig } from '@rspack/cli';
3+
import { rspack } from '@rspack/core';
4+
5+
export default defineConfig({
6+
entry: {
7+
main: './src/index.js',
8+
},
9+
experiments: {
10+
css: true,
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.css$/,
16+
use: [
17+
{
18+
loader: '@tailwindcss/webpack',
19+
options: {
20+
// ...
21+
},
22+
},
23+
],
24+
type: 'css',
25+
},
26+
],
27+
},
28+
plugins: [
29+
new rspack.HtmlRspackPlugin({
30+
template: './index.html',
31+
}),
32+
],
33+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const answer = 42;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import './main.css';
2+
import { answer } from './answer.js';
3+
4+
function render() {
5+
document.getElementById('root').innerHTML =
6+
`<h1 class="text-3xl font-bold underline">the answer to the universe is ${answer}</h1>`;
7+
}
8+
9+
render();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import "tailwindcss";

0 commit comments

Comments
 (0)