@tailwindcss/postcss 4.0.0-alpha.1 → 4.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/index.js +1 -61
- package/package.json +4 -4
package/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://tailwindcss.com" target="_blank">
|
3
|
+
<picture>
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
|
6
|
+
<img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
|
7
|
+
</picture>
|
8
|
+
</a>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p align="center">
|
12
|
+
A utility-first CSS framework for rapidly building custom user interfaces.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<p align="center">
|
16
|
+
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=next" alt="Build Status"></a>
|
17
|
+
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
18
|
+
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
19
|
+
<a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
|
20
|
+
</p>
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
## Documentation
|
25
|
+
|
26
|
+
For full documentation, visit [tailwindcss.com](https://tailwindcss.com).
|
27
|
+
|
28
|
+
## Community
|
29
|
+
|
30
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
31
|
+
|
32
|
+
[Discuss Tailwind CSS on GitHub](https://github.com/tailwindcss/tailwindcss/discussions)
|
33
|
+
|
34
|
+
For chatting with others using the framework:
|
35
|
+
|
36
|
+
[Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/next/.github/CONTRIBUTING.md) **before submitting a pull request**.
|
package/dist/index.js
CHANGED
@@ -1,63 +1,3 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
2
|
-
var _oxide = require('@tailwindcss/oxide');
|
3
|
-
var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
|
4
|
-
var _postcssimport = require('postcss-import'); var _postcssimport2 = _interopRequireDefault(_postcssimport);
|
5
|
-
var _tailwindcss = require('tailwindcss');
|
6
|
-
function tailwindcss(opts = {}) {
|
7
|
-
let base = _nullishCoalesce(opts.base, () => ( process.cwd()));
|
8
|
-
return {
|
9
|
-
postcssPlugin: "tailwindcss-v4",
|
10
|
-
plugins: [
|
11
|
-
// We need to run `postcss-import` first to handle `@import` rules.
|
12
|
-
_postcssimport2.default.call(void 0, ),
|
13
|
-
(root, result) => {
|
14
|
-
let hasApply = false;
|
15
|
-
let hasTailwind = false;
|
16
|
-
root.walkAtRules((rule) => {
|
17
|
-
if (rule.name === "apply") {
|
18
|
-
hasApply = true;
|
19
|
-
} else if (rule.name === "tailwind") {
|
20
|
-
hasApply = true;
|
21
|
-
hasTailwind = true;
|
22
|
-
return false;
|
23
|
-
}
|
24
|
-
});
|
25
|
-
if (!hasTailwind && !hasApply)
|
26
|
-
return;
|
27
|
-
function replaceCss(css) {
|
28
|
-
root.removeAll();
|
29
|
-
root.append(_postcss2.default.parse(_tailwindcss.optimizeCss.call(void 0, css), result.opts));
|
30
|
-
}
|
31
|
-
if (!hasTailwind) {
|
32
|
-
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), []));
|
33
|
-
return;
|
34
|
-
}
|
35
|
-
let { candidates, files, globs } = _oxide.scanDir.call(void 0, { base, globs: true });
|
36
|
-
for (let file of files) {
|
37
|
-
result.messages.push({
|
38
|
-
type: "dependency",
|
39
|
-
plugin: "tailwindcss-v4",
|
40
|
-
file,
|
41
|
-
parent: result.opts.from
|
42
|
-
});
|
43
|
-
}
|
44
|
-
for (let { base: base2, glob } of globs) {
|
45
|
-
result.messages.push({
|
46
|
-
type: "dir-dependency",
|
47
|
-
plugin: "tailwindcss-v4",
|
48
|
-
dir: base2,
|
49
|
-
glob,
|
50
|
-
parent: result.opts.from
|
51
|
-
});
|
52
|
-
}
|
53
|
-
replaceCss(_tailwindcss.compile.call(void 0, root.toString(), candidates));
|
54
|
-
}
|
55
|
-
]
|
56
|
-
};
|
57
|
-
}
|
58
|
-
var src_default = Object.assign(tailwindcss, { postcss: true });
|
59
|
-
|
60
|
-
|
61
|
-
exports.default = src_default;
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _oxide = require('@tailwindcss/oxide');var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);var _postcssimport = require('postcss-import'); var _postcssimport2 = _interopRequireDefault(_postcssimport);var _tailwindcss = require('tailwindcss');function b(r={}){let a=_nullishCoalesce(r.base, () => (process.cwd()));return{postcssPlugin:"tailwindcss-v4",plugins:[_postcssimport2.default.call(void 0, ),(s,t)=>{let i=!1,n=!1;if(s.walkAtRules(e=>{if(e.name==="apply")i=!0;else if(e.name==="tailwind")return i=!0,n=!0,!1}),!n&&!i)return;function p(e){s.removeAll(),s.append(_postcss2.default.parse(_tailwindcss.optimizeCss.call(void 0, e),t.opts))}if(!n){p(_tailwindcss.compile.call(void 0, s.toString(),[]));return}let{candidates:o,files:c,globs:f}=_oxide.scanDir.call(void 0, {base:a,globs:!0});for(let e of c)t.messages.push({type:"dependency",plugin:"tailwindcss-v4",file:e,parent:t.opts.from});for(let{base:e,glob:g}of f)t.messages.push({type:"dir-dependency",plugin:"tailwindcss-v4",dir:e,glob:g,parent:t.opts.from});p(_tailwindcss.compile.call(void 0, s.toString(),o))}]}}var v=Object.assign(b,{postcss:!0});exports.default = v;
|
62
2
|
|
63
3
|
module.exports = exports.default;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tailwindcss/postcss",
|
3
|
-
"version": "4.0.0-alpha.
|
3
|
+
"version": "4.0.0-alpha.2",
|
4
4
|
"description": "PostCSS plugin for Tailwind CSS, a utility-first CSS framework for rapidly building custom user interfaces",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "https://github.com/tailwindlabs/tailwindcss.git",
|
@@ -17,8 +17,8 @@
|
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
19
|
"postcss-import": "^16.0.0",
|
20
|
-
"@tailwindcss/oxide": "4.0.0-alpha.
|
21
|
-
"tailwindcss": "4.0.0-alpha.
|
20
|
+
"@tailwindcss/oxide": "4.0.0-alpha.2",
|
21
|
+
"tailwindcss": "4.0.0-alpha.2"
|
22
22
|
},
|
23
23
|
"devDependencies": {
|
24
24
|
"@types/node": "^20.11.17",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
},
|
28
28
|
"scripts": {
|
29
29
|
"lint": "tsc --noEmit",
|
30
|
-
"build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting",
|
30
|
+
"build": "tsup-node ./src/index.ts --format cjs --dts --cjsInterop --splitting --minify --clean",
|
31
31
|
"dev": "pnpm run build -- --watch"
|
32
32
|
}
|
33
33
|
}
|