Skip to content

Commit 227b421

Browse files
committed
update for Tailwind CSS 3
1 parent abc577a commit 227b421

11 files changed

+2899
-3195
lines changed

empty.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

fake-jiti/index.js

Whitespace-only changes.

fast-glob.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
sync: (patterns) => [].concat(patterns),
3+
generateTasks: (patterns) => [
4+
{
5+
positive: [].concat(patterns),
6+
negative: [],
7+
},
8+
],
9+
escapePath: (path) => path,
10+
};

fs.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
module.exports = {}
1+
const { fsStore } = require("./fsStore");
2+
3+
module.exports = {
4+
readFileSync: (path) => {
5+
if (fsStore.has(path)) {
6+
return fsStore.get(path).content;
7+
}
8+
throw new Error(`ENOENT: no such file or directory, open '${path}'`);
9+
},
10+
statSync: (path) => {
11+
if (fsStore.has(path)) {
12+
return fsStore.get(path).stat;
13+
}
14+
throw new Error(`ENOENT: no such file or directory, stat '${path}'`);
15+
},
16+
lstatSync: (path) => {
17+
if (fsStore.has(path)) {
18+
return fsStore.get(path).stat;
19+
}
20+
throw new Error(`ENOENT: no such file or directory, stat '${path}'`);
21+
},
22+
promises: {
23+
readFile: async (path) => {
24+
return module.exports.readFileSync(path);
25+
},
26+
},
27+
};

fsStore.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import preflight from "!!raw-loader!tailwindcss/lib/css/preflight.css";
2+
3+
export class Stat {
4+
constructor(props) {
5+
Object.assign(this, props);
6+
}
7+
isSymbolicLink() {
8+
return false;
9+
}
10+
}
11+
12+
const fsStore = new Map();
13+
fsStore.set("/css/preflight.css", {
14+
content: preflight,
15+
stat: new Stat({ mtimeMs: 1 }),
16+
});
17+
18+
export { fsStore };

index.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
module.exports = require('tailwindcss')
1+
// @ts-check
2+
import autoprefixer from "autoprefixer";
3+
import postcss from "postcss";
4+
import tailwindcss from "tailwindcss";
5+
import { Stat, fsStore } from "./fsStore";
6+
7+
let mtimeMs = 1;
8+
9+
export async function compile({ config, htmlInput, cssInput }) {
10+
fsStore.set("/html.html", {
11+
content: htmlInput,
12+
stat: new Stat({ mtimeMs: mtimeMs++ }),
13+
});
14+
const css = (
15+
await postcss([tailwindcss(config), autoprefixer()]).process(cssInput, {
16+
from: "/html.html",
17+
})
18+
).css;
19+
return { css };
20+
}
21+
22+
export { fsStore };

package.json

+21-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,33 @@
22
"name": "tailwindcss-standalone",
33
"version": "0.0.0",
44
"main": "dist/index.js",
5-
"files": ["dist"],
5+
"files": [
6+
"dist"
7+
],
68
"author": "EGOIST <[email protected]>",
79
"license": "MIT",
810
"scripts": {
911
"test": "yarn build",
10-
"build": "rm -rf dist && yarn webpack --mode production"
12+
"build": "rm -rf dist && yarn webpack --mode development"
1113
},
1214
"devDependencies": {
13-
"postcss": "^7.0.27",
15+
"assert": "^2.1.0",
16+
"autoprefixer": "^10.4.19",
17+
"buffer": "^6.0.3",
18+
"crypto-browserify": "^3.12.0",
19+
"os-browserify": "^0.3.0",
20+
"path-browserify": "^1.0.1",
21+
"postcss": "^8.4.24",
22+
"process": "^0.11.10",
23+
"raw-loader": "^4.0.2",
1424
"size-plugin": "^2.0.1",
15-
"tailwindcss": "^1.2.0",
16-
"webpack": "^4.42.0",
17-
"webpack-cli": "^3.3.11"
25+
"stream-browserify": "^3.0.0",
26+
"tailwindcss": "^3.4.3",
27+
"tty-browserify": "^0.0.1",
28+
"url": "^0.11.3",
29+
"util": "^0.12.5",
30+
"vm-browserify": "^1.1.2",
31+
"webpack": "^5.91.0",
32+
"webpack-cli": "^5.1.4"
1833
}
1934
}

0 commit comments

Comments
 (0)