tailwind.com 0.1.0 → 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/README.md CHANGED
@@ -10,7 +10,7 @@ aarch64.
10
10
  [BEAM.com](https://github.com/sntran/BEAM.com). It takes the place of:
11
11
 
12
12
  - **The official `tailwindcss` program**: the same options, the same
13
- output, in one file of about 19 MB for all the systems and both CPUs.
13
+ output, in one file of about 20 MB for all the systems and both CPUs.
14
14
  - **The Hex package `tailwind`** in a Phoenix project: this repository
15
15
  is also an Erlang and Elixir project with the application name
16
16
  `tailwind`, the module `Tailwind`, and the tasks `mix tailwind` and
@@ -20,6 +20,10 @@ The compiler follows Tailwind CSS 4.3.5 file by file. The tests compare
20
20
  its output with the recorded output of the official compiler: see
21
21
  [Compatibility](#compatibility).
22
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
+
23
27
  ## Quick start
24
28
 
25
29
  ```sh
@@ -56,9 +60,12 @@ tailwind.com [--input input.css] [--output output.css] [--watch] [--poll=ms] [op
56
60
  In `mix.exs`, replace the Hex package `tailwind`:
57
61
 
58
62
  ```elixir
59
- {:tailwind, github: "sntran/tailwind.com", runtime: Mix.env() == :dev}
63
+ {:tailwind, github: "sntran/tailwind.com", tag: "v0.2.0", runtime: Mix.env() == :dev}
60
64
  ```
61
65
 
66
+ The modules of a release download the `tailwind.com` of that release.
67
+ With no `tag`, the modules come from `main`.
68
+
62
69
  The configuration of the project does not change:
63
70
 
64
71
  ```elixir
@@ -73,6 +80,9 @@ config :tailwind,
73
80
  ]
74
81
  ```
75
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
+
76
86
  `mix tailwind.install` downloads `tailwind.com` to `_build/`, and
77
87
  `mix tailwind my_app` runs it. The watcher of the endpoint
78
88
  (`tailwind: {Tailwind, :install_and_run, [:my_app, ~w(--watch)]}`) works
@@ -129,6 +139,47 @@ Each release also publishes the package to GitHub Packages, with the
129
139
  name `@sntran/tailwind.com` (registry `https://npm.pkg.github.com`), and
130
140
  holds the package file itself.
131
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
+
132
183
  ## Compatibility
133
184
 
134
185
  The output of the official compiler is the specification. `cargo test`
@@ -155,10 +206,10 @@ tests, and a TLA+ model of the watch.
155
206
 
156
207
  [`docs/BENCHMARKS.md`](docs/BENCHMARKS.md) compares the time, the memory
157
208
  and the size with the official npm CLI and the official standalone
158
- program. For example, the Phoenix project: 10 ms with `tailwind.com`,
159
- 141 ms with the npm CLI and 123 ms with the standalone program. A
160
- project with daisyUI: 140 ms, 241 ms and 186 ms, with 13 MB of memory in
161
- place of 101 MB and 91 MB.
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.
162
213
 
163
214
  CI runs `tailwind.com` on Linux (x86_64 and aarch64), macOS (arm64 and
164
215
  x86_64), Windows (x86_64), FreeBSD, NetBSD and OpenBSD 7.3 (x86_64, in
@@ -167,7 +218,8 @@ file events of each system (inotify, kqueue, `ReadDirectoryChangesW`)
167
218
  and with the poll.
168
219
 
169
220
  A differential fuzzer also compares the two compilers live on new random
170
- stylesheets, classes and projects, in CI for each push and each night.
221
+ stylesheets, classes and projects, in CI for each change of the compiler
222
+ and each night.
171
223
 
172
224
  The scanner of source files is the Rust crate of Tailwind CSS itself
173
225
  (`tailwindcss-oxide`), and `--minify` and `--optimize` use the same
@@ -231,6 +283,9 @@ differences.
231
283
  earlier.
232
284
  - `canonicalize`, the second command of the official program, is not
233
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.
234
289
 
235
290
  See [`docs/ROADMAP.md`](docs/ROADMAP.md).
236
291
 
@@ -239,16 +294,21 @@ See [`docs/ROADMAP.md`](docs/ROADMAP.md).
239
294
  `tailwind.wasm` of each release is the same program for WASI
240
295
  (`wasm32-wasip1`): it runs in Node.js, Wasmtime, and other hosts with a
241
296
  WASI file system. It has the same JavaScript engine for `@plugin` and
242
- `@config`, with TypeScript and the three plugins in the file.
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)).
243
300
 
244
301
  ## Documentation
245
302
 
246
303
  | File | What |
247
304
  |---|---|
248
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. |
249
308
  | [`docs/INTERNALS.md`](docs/INTERNALS.md) | The parts of the compiler and of the file, and how they relate to Tailwind CSS. |
250
309
  | [`docs/BUILDING.md`](docs/BUILDING.md), [`docs/TESTING.md`](docs/TESTING.md) | Build `tailwind.com`, and the tests. |
251
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. |
252
312
  | [`docs/SYNC.md`](docs/SYNC.md) | Move to a new version of Tailwind CSS. |
253
313
  | [`docs/ROADMAP.md`](docs/ROADMAP.md) | What comes next. |
254
314
  | [`CHANGELOG.md`](CHANGELOG.md) | The changes of each version. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind.com",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Tailwind CSS in one executable file, with no Node.js at run time: npx tailwind.com, and the same compiler as WebAssembly",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1 +1 @@
1
- {"version": "0.1.0", "tag": "v0.1.0", "tailwindcss": "4.3.5", "sha256": "222bced6bd7143d2f88d3afda5d08bdb458d265a5a02d28148d2b116547ab496"}
1
+ {"version": "0.2.0", "tag": "v0.2.0", "tailwindcss": "4.3.5", "sha256": "fef33f11c8afd26c3d7e2be9de7bd46171b8c36bb359200e4dd2c62e4235ebc9"}
Binary file