tailwind.com 0.0.0-stage → 0.2.0
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/LICENSE +202 -0
- package/NOTICE +97 -0
- package/README.md +326 -2
- package/js/download.mjs +119 -0
- package/js/node.mjs +92 -0
- package/js/tailwind.com.mjs +35 -0
- package/licenses/cosmopolitan.txt +16 -0
- package/licenses/jridgewell.txt +19 -0
- package/licenses/magic-string.txt +7 -0
- package/licenses/mpl-2.0.txt +373 -0
- package/licenses/musl.txt +193 -0
- package/licenses/quickjs.txt +22 -0
- package/licenses/source-map-js.txt +28 -0
- package/licenses/sucrase.txt +258 -0
- package/licenses/tailwindcss-plugins.txt +166 -0
- package/licenses/tailwindcss.txt +21 -0
- package/package.json +28 -4
- package/runtime/release.json +1 -0
- package/runtime/tailwind.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
tailwind.com
|
|
2
|
+
Copyright 2026 Sơn Trần-Nguyễn
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see
|
|
5
|
+
LICENSE).
|
|
6
|
+
|
|
7
|
+
The compiler in native/tailwind is a port to Rust of the compiler of
|
|
8
|
+
Tailwind CSS, and the file tailwind.com contains the software below. The
|
|
9
|
+
source of this repository keeps the license texts in licenses/.
|
|
10
|
+
|
|
11
|
+
Tailwind CSS 4.3.5 (the compiler that native/tailwind follows file by
|
|
12
|
+
file, the stylesheets in native/tailwind/assets, the plugin layer in
|
|
13
|
+
native/tailwind/assets/compat.js, the scanner crate tailwindcss-oxide,
|
|
14
|
+
and the recorded test data in tests/upstream)
|
|
15
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
16
|
+
MIT License (licenses/tailwindcss.txt).
|
|
17
|
+
https://github.com/tailwindlabs/tailwindcss
|
|
18
|
+
|
|
19
|
+
Lightning CSS 1.0.0-alpha.72 (the optimizer of --minify and --optimize)
|
|
20
|
+
Copyright Devon Govett and the contributors of Lightning CSS.
|
|
21
|
+
Mozilla Public License 2.0 (licenses/mpl-2.0.txt). The source is at
|
|
22
|
+
https://github.com/parcel-bundler/lightningcss
|
|
23
|
+
|
|
24
|
+
source-map-js 1.2, magic-string 1, and @jridgewell/remapping 2.3 with
|
|
25
|
+
@jridgewell/trace-mapping, @jridgewell/gen-mapping, @jridgewell/resolve-uri
|
|
26
|
+
and @jridgewell/sourcemap-codec (native/tailwind/src/cli/source_maps.rs
|
|
27
|
+
and native/tailwind/src/cli/remapping.rs follow the parts of these
|
|
28
|
+
packages that Tailwind CSS uses for its source maps)
|
|
29
|
+
Copyright (c) 2009-2011, Mozilla Foundation and contributors.
|
|
30
|
+
BSD 3-Clause License (licenses/source-map-js.txt).
|
|
31
|
+
Copyright 2018 Rich Harris. MIT License (licenses/magic-string.txt).
|
|
32
|
+
Copyright 2019-2024 Justin Ridgewell. MIT License
|
|
33
|
+
(licenses/jridgewell.txt).
|
|
34
|
+
|
|
35
|
+
QuickJS 2026-06-04 (the JavaScript engine for @plugin and @config, in
|
|
36
|
+
c_src/quickjs)
|
|
37
|
+
Copyright (c) 2017-2021 Fabrice Bellard; Copyright (c) 2017-2021
|
|
38
|
+
Charlie Gordon.
|
|
39
|
+
MIT License (licenses/quickjs.txt).
|
|
40
|
+
https://github.com/bellard/quickjs (commit e585640)
|
|
41
|
+
|
|
42
|
+
@tailwindcss/forms 0.5.11 with mini-svg-data-uri 1.4.4,
|
|
43
|
+
@tailwindcss/typography 0.5.20 with postcss-selector-parser 6.0.10,
|
|
44
|
+
cssesc 3.0.0 and util-deprecate 1.0.2, and @tailwindcss/aspect-ratio 0.4.2
|
|
45
|
+
(the plugins that the standalone program of Tailwind CSS has in its file,
|
|
46
|
+
in native/tailwind/assets/plugins)
|
|
47
|
+
Copyright (c) Tailwind Labs, Inc.; Copyright (c) 2018 Taylor Hunt;
|
|
48
|
+
Copyright (c) Ben Briggs; Copyright Mathias Bynens; Copyright (c) 2014
|
|
49
|
+
Nathan Rajlich.
|
|
50
|
+
MIT License (licenses/tailwindcss-plugins.txt).
|
|
51
|
+
https://github.com/tailwindlabs/tailwindcss-forms
|
|
52
|
+
https://github.com/tailwindlabs/tailwindcss-typography
|
|
53
|
+
https://github.com/tailwindlabs/tailwindcss-aspect-ratio
|
|
54
|
+
|
|
55
|
+
Sucrase 3.35.1 with lines-and-columns 1.2.4, ts-interface-checker 0.1.13,
|
|
56
|
+
@jridgewell/gen-mapping and @jridgewell/sourcemap-codec (the TypeScript
|
|
57
|
+
transform for TypeScript configs and plugins, in
|
|
58
|
+
native/tailwind/assets/typescript.js)
|
|
59
|
+
Copyright (c) 2012-2018 various contributors (the authors of Sucrase
|
|
60
|
+
and of Babel); Copyright (c) 2015 Brian Donovan. MIT License
|
|
61
|
+
(licenses/sucrase.txt).
|
|
62
|
+
ts-interface-checker: Copyright Grist Labs. Apache License 2.0
|
|
63
|
+
(licenses/sucrase.txt).
|
|
64
|
+
Copyright 2019-2024 Justin Ridgewell. MIT License
|
|
65
|
+
(licenses/jridgewell.txt).
|
|
66
|
+
https://github.com/alangpierce/sucrase
|
|
67
|
+
|
|
68
|
+
Cosmopolitan Libc 4.0.2 (the C runtime of the APE file)
|
|
69
|
+
Copyright 2020 Justine Alexandra Roberts Tunney.
|
|
70
|
+
ISC License (licenses/cosmopolitan.txt). Cosmopolitan also links code
|
|
71
|
+
of other projects under the licenses that its source names.
|
|
72
|
+
https://github.com/jart/cosmopolitan
|
|
73
|
+
|
|
74
|
+
The Rust standard library and musl (in the Rust library of the file)
|
|
75
|
+
Copyright The Rust Project Developers; Copyright 2005-2020 Rich Felker
|
|
76
|
+
and the contributors of musl.
|
|
77
|
+
MIT License or Apache License 2.0 (Rust), MIT License
|
|
78
|
+
(licenses/musl.txt).
|
|
79
|
+
|
|
80
|
+
The other Rust crates of Cargo.lock
|
|
81
|
+
Each crate has its license in its source (MIT, Apache-2.0, MPL-2.0,
|
|
82
|
+
BSD or Unlicense). "cargo tree" lists them.
|
|
83
|
+
|
|
84
|
+
c_src/cosmo_rust.c, c_src/eh_frame_pad.ld and scripts/rust_link.sh come
|
|
85
|
+
from BEAM.com (Apache License 2.0), by the same author. The parts of
|
|
86
|
+
c_src/watch.c for inotify and kqueue, and the job bsd of
|
|
87
|
+
.github/workflows/build.yml, follow the file watcher and the job
|
|
88
|
+
test-bsd of BEAM.com.
|
|
89
|
+
https://github.com/sntran/BEAM.com
|
|
90
|
+
|
|
91
|
+
scripts/remote_ssh_runner.sh and .github/workflows/remote-ssh.yml follow
|
|
92
|
+
the remote SSH workflow of BEAM.com.
|
|
93
|
+
|
|
94
|
+
The test projects in tests/upstream/cli-js contain files of other
|
|
95
|
+
projects (daisyUI, Phoenix, heroicons, topbar and npm packages).
|
|
96
|
+
tests/upstream/cli-js/NOTICE.md names them. They are not in the file
|
|
97
|
+
tailwind.com.
|
package/README.md
CHANGED
|
@@ -1,3 +1,327 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tailwind.com
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tailwind CSS 4 in one executable file, with no Node.js. The same file
|
|
4
|
+
runs on Linux, macOS, Windows, FreeBSD, NetBSD and OpenBSD, on x86_64 and
|
|
5
|
+
aarch64.
|
|
6
|
+
|
|
7
|
+
`tailwind.com` is a Tailwind CSS compiler in Rust, as one
|
|
8
|
+
[Actually Portable Executable](https://justine.lol/ape.html) made with
|
|
9
|
+
[Cosmopolitan Libc](https://github.com/jart/cosmopolitan), in the way of
|
|
10
|
+
[BEAM.com](https://github.com/sntran/BEAM.com). It takes the place of:
|
|
11
|
+
|
|
12
|
+
- **The official `tailwindcss` program**: the same options, the same
|
|
13
|
+
output, in one file of about 20 MB for all the systems and both CPUs.
|
|
14
|
+
- **The Hex package `tailwind`** in a Phoenix project: this repository
|
|
15
|
+
is also an Erlang and Elixir project with the application name
|
|
16
|
+
`tailwind`, the module `Tailwind`, and the tasks `mix tailwind` and
|
|
17
|
+
`mix tailwind.install`.
|
|
18
|
+
|
|
19
|
+
The compiler follows Tailwind CSS 4.3.5 file by file. The tests compare
|
|
20
|
+
its output with the recorded output of the official compiler: see
|
|
21
|
+
[Compatibility](#compatibility).
|
|
22
|
+
|
|
23
|
+
The compiler can also compile as each older version of Tailwind CSS 4,
|
|
24
|
+
from 4.0.0, and the file has the official compiler of each of these
|
|
25
|
+
versions too: see [Versions of Tailwind CSS](#versions-of-tailwind-css).
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
curl -fLO https://github.com/sntran/tailwind.com/releases/latest/download/tailwind.com
|
|
31
|
+
sh ./tailwind.com --input app.css --output dist/app.css --minify
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
On Windows, run `tailwind.com` in the command prompt. With no `--input`,
|
|
35
|
+
the input is `@import "tailwindcss";`. The stylesheets of Tailwind CSS
|
|
36
|
+
(`tailwindcss`, `tailwindcss/theme`, `tailwindcss/preflight`,
|
|
37
|
+
`tailwindcss/utilities`) are in the file.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
tailwind.com [--input input.css] [--output output.css] [--watch] [--poll=ms] [options…]
|
|
41
|
+
|
|
42
|
+
-i, --input Input file (- for stdin)
|
|
43
|
+
-o, --output Output file (default: stdout)
|
|
44
|
+
-w, --watch Watch for changes and rebuild as needed; --watch=always
|
|
45
|
+
keeps the watch when stdin closes
|
|
46
|
+
--poll Use polling instead of file system events (--poll=ms
|
|
47
|
+
sets the interval)
|
|
48
|
+
-m, --minify Optimize and minify the output
|
|
49
|
+
--optimize Optimize the output without minifying
|
|
50
|
+
--map Generate a source map: in the output, or with --map=FILE
|
|
51
|
+
in a file
|
|
52
|
+
--cwd The current working directory
|
|
53
|
+
--silent Suppress non-error output
|
|
54
|
+
-h, --help Display usage information
|
|
55
|
+
-v, --version The versions of this program and of Tailwind CSS
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Phoenix
|
|
59
|
+
|
|
60
|
+
In `mix.exs`, replace the Hex package `tailwind`:
|
|
61
|
+
|
|
62
|
+
```elixir
|
|
63
|
+
{:tailwind, github: "sntran/tailwind.com", tag: "v0.2.0", runtime: Mix.env() == :dev}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The modules of a release download the `tailwind.com` of that release.
|
|
67
|
+
With no `tag`, the modules come from `main`.
|
|
68
|
+
|
|
69
|
+
The configuration of the project does not change:
|
|
70
|
+
|
|
71
|
+
```elixir
|
|
72
|
+
config :tailwind,
|
|
73
|
+
version: "4.3.5",
|
|
74
|
+
my_app: [
|
|
75
|
+
args: ~w(
|
|
76
|
+
--input=assets/css/app.css
|
|
77
|
+
--output=priv/static/assets/css/app.css
|
|
78
|
+
),
|
|
79
|
+
cd: Path.expand("..", __DIR__)
|
|
80
|
+
]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`version` can be each version of Tailwind CSS 4, for example the
|
|
84
|
+
`"4.3.0"` of a new Phoenix 1.8.9 project: the file has all of them.
|
|
85
|
+
|
|
86
|
+
`mix tailwind.install` downloads `tailwind.com` to `_build/`, and
|
|
87
|
+
`mix tailwind my_app` runs it. The watcher of the endpoint
|
|
88
|
+
(`tailwind: {Tailwind, :install_and_run, [:my_app, ~w(--watch)]}`) works
|
|
89
|
+
as before: the watch stops when the Phoenix server stops.
|
|
90
|
+
|
|
91
|
+
A new Phoenix project has `@plugin` lines in `assets/css/app.css` (for
|
|
92
|
+
heroicons and daisyUI). These plugins are JavaScript. The program runs
|
|
93
|
+
them: see [JavaScript plugins and configs](#javascript-plugins-and-configs).
|
|
94
|
+
The output for the project of `mix phx.new` is the same as the output of
|
|
95
|
+
the official program, byte for byte, for the two layouts of Phoenix 1.8:
|
|
96
|
+
daisyUI in `assets/vendor` (to 1.8.5), and daisyUI in `deps/` with
|
|
97
|
+
`NODE_PATH` and the `phoenix-colocated` import (1.8.6 and later).
|
|
98
|
+
|
|
99
|
+
An Erlang project uses the module `tailwind` (`tailwind:install/0`,
|
|
100
|
+
`tailwind:run/2`), with the same configuration in the application
|
|
101
|
+
environment.
|
|
102
|
+
|
|
103
|
+
## npm
|
|
104
|
+
|
|
105
|
+
This repository is also the npm package `tailwind.com`:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
npx tailwind.com -i app.css -o dist/app.css --minify
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The package does not hold `tailwind.com`. At the first run,
|
|
112
|
+
`npx tailwind.com` downloads the file of its release from GitHub, and
|
|
113
|
+
checks its SHA-256 against the value that the package holds. Then the
|
|
114
|
+
file stays in the cache (`~/.cache/tailwind.com/npm/`).
|
|
115
|
+
|
|
116
|
+
- `TAILWIND_COM`: the path of a `tailwind.com` to use. Then nothing is
|
|
117
|
+
downloaded.
|
|
118
|
+
- `TAILWIND_COM_DOWNLOAD`: the URL of a directory with the file
|
|
119
|
+
`tailwind.com`, in place of the GitHub release.
|
|
120
|
+
- `TAILWIND_COM_CACHE`: the cache directory.
|
|
121
|
+
|
|
122
|
+
The package has the WebAssembly module too, so a program in Node.js 22
|
|
123
|
+
or later can run the compiler in its own process, with no download:
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
import { run, runWasm } from 'tailwind.com';
|
|
127
|
+
|
|
128
|
+
// The native program:
|
|
129
|
+
await run(['-i', 'app.css', '-o', 'dist/app.css', '--minify']);
|
|
130
|
+
|
|
131
|
+
// The same program as WebAssembly. The directory `cwd` is all that it sees.
|
|
132
|
+
const { status, stdout, stderr } = await runWasm(['-i', 'app.css'], { cwd: 'project' });
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`import wasm from 'tailwind.com/tailwind.wasm'` gives the module itself,
|
|
136
|
+
for another WASI host.
|
|
137
|
+
|
|
138
|
+
Each release also publishes the package to GitHub Packages, with the
|
|
139
|
+
name `@sntran/tailwind.com` (registry `https://npm.pkg.github.com`), and
|
|
140
|
+
holds the package file itself.
|
|
141
|
+
|
|
142
|
+
## Versions of Tailwind CSS
|
|
143
|
+
|
|
144
|
+
One `tailwind.com` compiles for each version of Tailwind CSS 4. The
|
|
145
|
+
variable `TAILWINDCSS_VERSION` selects the version, and the Erlang and
|
|
146
|
+
Elixir modules set it from `version` of the configuration:
|
|
147
|
+
|
|
148
|
+
To try the versions with no install, open the site:
|
|
149
|
+
<https://sntran.github.io/tailwind.com/>. It runs `tailwind.wasm` in the
|
|
150
|
+
browser, and compares two versions, or the Rust compiler with the
|
|
151
|
+
official compiler of one version ([`docs/SITE.md`](docs/SITE.md)).
|
|
152
|
+
|
|
153
|
+
```sh
|
|
154
|
+
TAILWINDCSS_VERSION=4.1.18 sh ./tailwind.com -i app.css -o dist/app.css
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The file has two engines:
|
|
158
|
+
|
|
159
|
+
- **The native engine** is the Rust compiler. It follows version 4.3.5,
|
|
160
|
+
and it has a switch for each behavior that changed since 4.0.0, so it
|
|
161
|
+
serves each version from 4.0.0 to 4.3.5, also with JavaScript plugins
|
|
162
|
+
([`docs/SWITCHES.md`](docs/SWITCHES.md)). It is the
|
|
163
|
+
fast one: about 12 ms for a Phoenix project, in each version.
|
|
164
|
+
- **The script engine** is the official compiler of the npm package
|
|
165
|
+
`tailwindcss` of a version (one JavaScript file with no dependency),
|
|
166
|
+
with no change, in the QuickJS of the file. It needs about 83 ms for
|
|
167
|
+
the same project, and the official programs need 139 ms to 186 ms. The
|
|
168
|
+
package of each version is in the ZIP directory of the file: an APE
|
|
169
|
+
file is also a ZIP file. The file has the newest package in full, and
|
|
170
|
+
each older version as a small patch: the differences from the next
|
|
171
|
+
newer version. So the 48 versions from 4.0.0 to 4.3.5 are 0.37 MB of
|
|
172
|
+
the file.
|
|
173
|
+
|
|
174
|
+
A new version of Tailwind CSS thus needs one line in the file
|
|
175
|
+
[`PACKAGES`](PACKAGES), and no change of the code. The port to the
|
|
176
|
+
native engine can come later.
|
|
177
|
+
|
|
178
|
+
For another version than 4.3.5, the scanner and the optimizer are still
|
|
179
|
+
the code of this file: with `--minify` or `--optimize`, the text can be
|
|
180
|
+
different from the official program of that version in small details.
|
|
181
|
+
See [`docs/VERSIONS.md`](docs/VERSIONS.md).
|
|
182
|
+
|
|
183
|
+
## Compatibility
|
|
184
|
+
|
|
185
|
+
The output of the official compiler is the specification. `cargo test`
|
|
186
|
+
replays these records of Tailwind CSS 4.3.5 (`tests/upstream`), and
|
|
187
|
+
expects the same text, byte for byte:
|
|
188
|
+
|
|
189
|
+
| Record | Size |
|
|
190
|
+
|---|---|
|
|
191
|
+
| Each `compile` call of the unit tests of Tailwind CSS | 2,334 calls |
|
|
192
|
+
| Each class of the default design system, each variant, 6,000 random candidates and 784 edge cases, one at a time | 75,082 candidates |
|
|
193
|
+
| The same candidates in one build (the sort of the output) | 24 MB of CSS |
|
|
194
|
+
| `@import "tailwindcss"` with real-world classes, also through the optimizer | 686 candidates |
|
|
195
|
+
| The official command line program on small projects, also the warnings of the optimizer and of `@utility` | 20 projects |
|
|
196
|
+
| The source maps of the official compiler and of its optimizer | 317 stylesheets |
|
|
197
|
+
| The official command line program with `--map`, also with a JavaScript plugin and config | 29 projects |
|
|
198
|
+
| The official command line program on projects with JavaScript and TypeScript plugins and configs (daisyUI, heroicons, `@tailwindcss/typography`, `@tailwindcss/forms`, two Phoenix projects) | 100 projects |
|
|
199
|
+
| The `compile` calls of the unit tests of Tailwind CSS that load a JavaScript plugin or config | 296 calls |
|
|
200
|
+
| Node.js 22 for the parts of Node.js that a plugin gets (`Buffer`, `URL`, timers, `fs`, `util`, ...), and for the files that `require` and `import` find | 124 values, 160 questions |
|
|
201
|
+
|
|
202
|
+
See [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md) for the results and
|
|
203
|
+
the known differences, and [`docs/TESTING.md`](docs/TESTING.md) for the
|
|
204
|
+
other tests: unit tests from the test files of Tailwind CSS, property
|
|
205
|
+
tests, and a TLA+ model of the watch.
|
|
206
|
+
|
|
207
|
+
[`docs/BENCHMARKS.md`](docs/BENCHMARKS.md) compares the time, the memory
|
|
208
|
+
and the size with the official npm CLI and the official standalone
|
|
209
|
+
program. For example, the Phoenix project: 12 ms with `tailwind.com`,
|
|
210
|
+
186 ms with the npm CLI and 139 ms with the standalone program. A
|
|
211
|
+
project with daisyUI: 182 ms, 310 ms and 251 ms, with 13 MB of memory in
|
|
212
|
+
place of 103 MB and 89 MB.
|
|
213
|
+
|
|
214
|
+
CI runs `tailwind.com` on Linux (x86_64 and aarch64), macOS (arm64 and
|
|
215
|
+
x86_64), Windows (x86_64), FreeBSD, NetBSD and OpenBSD 7.3 (x86_64, in
|
|
216
|
+
a VM): the projects of the official program, and the watch with the
|
|
217
|
+
file events of each system (inotify, kqueue, `ReadDirectoryChangesW`)
|
|
218
|
+
and with the poll.
|
|
219
|
+
|
|
220
|
+
A differential fuzzer also compares the two compilers live on new random
|
|
221
|
+
stylesheets, classes and projects, in CI for each change of the compiler
|
|
222
|
+
and each night.
|
|
223
|
+
|
|
224
|
+
The scanner of source files is the Rust crate of Tailwind CSS itself
|
|
225
|
+
(`tailwindcss-oxide`), and `--minify` and `--optimize` use the same
|
|
226
|
+
version of Lightning CSS with the same options.
|
|
227
|
+
|
|
228
|
+
## JavaScript plugins and configs
|
|
229
|
+
|
|
230
|
+
`@plugin` and `@config` work. The file has a JavaScript engine
|
|
231
|
+
([QuickJS](https://bellard.org/quickjs/)), and the plugin API is the
|
|
232
|
+
JavaScript of Tailwind CSS itself (`addBase`, `addUtilities`,
|
|
233
|
+
`matchUtilities`, `addComponents`, `matchComponents`, `addVariant`,
|
|
234
|
+
`matchVariant`, `theme()`, `config()`, `plugin.withOptions`, presets,
|
|
235
|
+
`darkMode`, `prefix`, `important`, `content`, `blocklist`).
|
|
236
|
+
|
|
237
|
+
- A module is a CommonJS file or an ES module (`.js`, `.cjs`, `.mjs`),
|
|
238
|
+
a TypeScript file (`.ts`, `.mts`, `.cts`), or a JSON file. `require`
|
|
239
|
+
and `import` find relative files and packages in `node_modules`
|
|
240
|
+
(`exports`, `imports` and `main` of `package.json`), and the
|
|
241
|
+
directories of `NODE_PATH`.
|
|
242
|
+
- **TypeScript**: `@config "./tailwind.config.ts"` and
|
|
243
|
+
`@plugin "./plugin.ts"` work. The program removes the types. It does
|
|
244
|
+
not check them, as the official program.
|
|
245
|
+
- `tailwindcss/plugin`, `tailwindcss/colors`, `tailwindcss/defaultTheme`
|
|
246
|
+
and `tailwindcss/lib/util/flattenColorPalette` are in the file. A
|
|
247
|
+
project needs no `node_modules` for them.
|
|
248
|
+
- `@tailwindcss/forms`, `@tailwindcss/typography` and
|
|
249
|
+
`@tailwindcss/aspect-ratio` are in the file, as in the standalone
|
|
250
|
+
program of Tailwind CSS: `@plugin "@tailwindcss/typography"` works
|
|
251
|
+
with no `node_modules`.
|
|
252
|
+
- A module gets a part of Node.js: `Buffer`, `URL`, `TextEncoder`,
|
|
253
|
+
`setTimeout`, `structuredClone`, `process.env`, and the modules `fs`
|
|
254
|
+
(reads only), `path`, `os`, `url`, `util`, `assert` and `module`.
|
|
255
|
+
- A module cannot write files, start a process, or open a network
|
|
256
|
+
connection: such a call throws an error that names the rule (see
|
|
257
|
+
[`SECURITY.md`](SECURITY.md)).
|
|
258
|
+
- The watch builds again when a plugin or config file changes.
|
|
259
|
+
|
|
260
|
+
What does not work:
|
|
261
|
+
|
|
262
|
+
- **The other modules of Node.js** (`crypto`, `stream`, `events`,
|
|
263
|
+
`zlib`, ...), `Intl` and `Temporal`. A plugin that needs them at load
|
|
264
|
+
time gives an error.
|
|
265
|
+
- **A TypeScript file with JSX** (`.tsx`), and decorators.
|
|
266
|
+
- **`import "tailwindcss"` for a value** in a config (the full compiler
|
|
267
|
+
as a JavaScript module). `import type { Config } from "tailwindcss"`
|
|
268
|
+
works: a type import has no JavaScript.
|
|
269
|
+
|
|
270
|
+
See [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md) for all the
|
|
271
|
+
differences.
|
|
272
|
+
|
|
273
|
+
## Limits
|
|
274
|
+
|
|
275
|
+
- **Source maps of the stylesheets in the file**: with `--map`, a
|
|
276
|
+
source of a stylesheet of Tailwind CSS that is in the program has the
|
|
277
|
+
path `/$tailwindcss/NAME.css`. With `node_modules/tailwindcss` in the
|
|
278
|
+
project, the path is the path of the file, as with the official
|
|
279
|
+
program.
|
|
280
|
+
- **NetBSD and OpenBSD**: the `sh` of NetBSD cannot read an APE file.
|
|
281
|
+
Start the file there with the APE loader of cosmocc
|
|
282
|
+
(`ape-x86_64.elf tailwind.com`). Cosmopolitan supports OpenBSD 7.3 or
|
|
283
|
+
earlier.
|
|
284
|
+
- `canonicalize`, the second command of the official program, is not
|
|
285
|
+
there.
|
|
286
|
+
- **Tailwind CSS 3** (a project with only `tailwind.config.js` and
|
|
287
|
+
`@tailwind` rules, and `version: "3.x"`) does not work: it is another
|
|
288
|
+
program. Use the official Hex package or program for it.
|
|
289
|
+
|
|
290
|
+
See [`docs/ROADMAP.md`](docs/ROADMAP.md).
|
|
291
|
+
|
|
292
|
+
## WebAssembly
|
|
293
|
+
|
|
294
|
+
`tailwind.wasm` of each release is the same program for WASI
|
|
295
|
+
(`wasm32-wasip1`): it runs in Node.js, Wasmtime, and other hosts with a
|
|
296
|
+
WASI file system. It has the same JavaScript engine for `@plugin` and
|
|
297
|
+
`@config`, with TypeScript and the three plugins in the file. The site
|
|
298
|
+
runs it in the browser, with a small WASI host in JavaScript
|
|
299
|
+
(`site/wasi.mjs`, [`docs/SITE.md`](docs/SITE.md)).
|
|
300
|
+
|
|
301
|
+
## Documentation
|
|
302
|
+
|
|
303
|
+
| File | What |
|
|
304
|
+
|---|---|
|
|
305
|
+
| [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md) | The results against Tailwind CSS, and the known differences. |
|
|
306
|
+
| [`docs/VERSIONS.md`](docs/VERSIONS.md) | The versions of Tailwind CSS in the file, and the two engines. |
|
|
307
|
+
| [`docs/SWITCHES.md`](docs/SWITCHES.md) | The Rust compiler as an older version: how to write a switch, and the list of the changes of Tailwind CSS 4.3. |
|
|
308
|
+
| [`docs/INTERNALS.md`](docs/INTERNALS.md) | The parts of the compiler and of the file, and how they relate to Tailwind CSS. |
|
|
309
|
+
| [`docs/BUILDING.md`](docs/BUILDING.md), [`docs/TESTING.md`](docs/TESTING.md) | Build `tailwind.com`, and the tests. |
|
|
310
|
+
| [`docs/BENCHMARKS.md`](docs/BENCHMARKS.md) | The time, the memory and the size, against the official programs. |
|
|
311
|
+
| [`docs/SITE.md`](docs/SITE.md) | The site on GitHub Pages: `tailwind.wasm` in the browser, with each version. |
|
|
312
|
+
| [`docs/SYNC.md`](docs/SYNC.md) | Move to a new version of Tailwind CSS. |
|
|
313
|
+
| [`docs/ROADMAP.md`](docs/ROADMAP.md) | What comes next. |
|
|
314
|
+
| [`CHANGELOG.md`](CHANGELOG.md) | The changes of each version. |
|
|
315
|
+
|
|
316
|
+
## Contributing
|
|
317
|
+
|
|
318
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md). Report a security problem in
|
|
319
|
+
private: see [`SECURITY.md`](SECURITY.md).
|
|
320
|
+
|
|
321
|
+
## License
|
|
322
|
+
|
|
323
|
+
tailwind.com is licensed under the [Apache License 2.0](LICENSE). The
|
|
324
|
+
compiler is a port of Tailwind CSS (MIT License), and the file
|
|
325
|
+
`tailwind.com` contains other software under its own licenses:
|
|
326
|
+
[`NOTICE`](NOTICE) names them, and the license texts are in
|
|
327
|
+
[`licenses/`](licenses).
|