Skip to content

Commit 0f8bab3

Browse files
committed
init: tailwindcss-obfuscator monorepo
Tailwind CSS class obfuscator for production builds. Plugins for Vite, Webpack, Rollup, esbuild, and a Nuxt module — all built on unplugin so the same obfuscation pipeline works across Next.js, Nuxt, SvelteKit, Astro, Solid, Qwik, Remix / React Router 7, TanStack Router, Vue, and plain HTML. Supports Tailwind v3 (config-based) and v4 (CSS-first). Monorepo layout: - packages/tailwindcss-obfuscator/ — the published npm package - apps/test-* — 17 reference apps exercising every framework - docs/ — VitePress site deployed to GitHub Pages - .github/workflows/{ci,release,docs}.yml — full CI/CD pipeline
0 parents  commit 0f8bab3

553 files changed

Lines changed: 90233 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changesets
2+
3+
This directory contains [changesets](https://github.com/changesets/changesets) used to version and publish the `tailwindcss-obfuscator` package.
4+
5+
## Adding a changeset
6+
7+
When you make a change that should appear in the changelog or trigger a release, run:
8+
9+
```bash
10+
pnpm changeset
11+
```
12+
13+
You will be prompted to:
14+
15+
1. Select the package(s) affected.
16+
2. Pick the bump type (`patch`, `minor`, `major`).
17+
3. Write a short summary that will end up in `CHANGELOG.md`.
18+
19+
Commit the resulting markdown file alongside your code change.
20+
21+
## Releasing
22+
23+
The `Release` GitHub Actions workflow consumes changesets on `main`:
24+
25+
- If pending changesets exist, it opens a "Version Packages" PR that bumps versions and updates the changelog.
26+
- When that PR is merged, the workflow publishes the new version to npm.
27+
28+
You should never edit `package.json` versions or `CHANGELOG.md` by hand.

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "josedacosta/tailwindcss-obfuscator" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/initial-release.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
"tailwindcss-obfuscator": major
3+
---
4+
5+
Initial public release.
6+
7+
`tailwindcss-obfuscator` rewrites Tailwind CSS class names to short opaque
8+
identifiers (`tw-a`, `tw-b`, …) at build time, in both the generated CSS and
9+
every `class=` / `className=` attribute that references them. It supports
10+
Tailwind v3 and v4, ships first-party plugins for Vite, Webpack, Rollup,
11+
esbuild, and Nuxt, and is verified against 17 sample apps covering React /
12+
Next.js / Vue / Nuxt / SvelteKit / Astro / Solid / Qwik / React Router v7 /
13+
TanStack Router / static HTML and the standalone Webpack and Rollup
14+
configurations.
15+
16+
### Public API
17+
18+
- Plugins: `tailwindcss-obfuscator/{vite,webpack,rollup,esbuild,nuxt}`
19+
- CLI: `tw-obfuscator run|extract|transform`
20+
- `defineConfig`, `ObfuscatorOptions` types
21+
- Internal pipeline (`tailwindcss-obfuscator/internals`) for custom integrations
22+
23+
### Highlights
24+
25+
- AST-based JSX/TSX/Vue transformer with a generic `StringLiteral` and
26+
`TemplateElement` catch-all, covering shadcn `cva` variant tables and
27+
SSR-rendered HTML embedded in JS strings.
28+
- PostCSS selector rewriter with a regex safety net for CSS chunks PostCSS
29+
fails to parse.
30+
- Bundler-specific hooks for Vite (`generateBundle`, `transformIndexHtml`),
31+
Webpack (`processAssets`), Rollup (`generateBundle`), and Nitro (close hook).
32+
- Zero-config defaults; opt-in `preserve.classes`, `preserve.functions`,
33+
`cache`, `mapping`, and source-map generation.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig: https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_style = space
8+
indent_size = 2
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# CODEOWNERS — automatic review requests
2+
# Docs: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-security/customizing-your-repository/about-code-owners
3+
4+
* @josedacosta
5+
6+
/packages/tailwindcss-obfuscator/ @josedacosta
7+
/.github/ @josedacosta
8+
/apps/ @josedacosta

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sponsorship configuration
2+
# Docs: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-security/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
3+
4+
github: [josedacosta]
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Bug Report
2+
description: Report a reproducible problem with tailwindcss-obfuscator
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to file a bug report! Please fill out the sections below so we can investigate efficiently.
10+
11+
- type: checkboxes
12+
id: prerequisites
13+
attributes:
14+
label: Prerequisites
15+
options:
16+
- label: I have searched the existing issues and discussions.
17+
required: true
18+
- label: I am using the latest version of tailwindcss-obfuscator.
19+
required: true
20+
21+
- type: input
22+
id: version
23+
attributes:
24+
label: Package version
25+
placeholder: e.g. 1.2.0
26+
validations:
27+
required: true
28+
29+
- type: dropdown
30+
id: tailwind
31+
attributes:
32+
label: Tailwind CSS version
33+
options:
34+
- v4
35+
- v3
36+
- other
37+
validations:
38+
required: true
39+
40+
- type: dropdown
41+
id: bundler
42+
attributes:
43+
label: Bundler / framework
44+
options:
45+
- Vite
46+
- Webpack
47+
- Rollup
48+
- esbuild
49+
- Next.js
50+
- Nuxt
51+
- SvelteKit
52+
- Astro
53+
- Remix
54+
- Qwik
55+
- Solid Start
56+
- Other
57+
validations:
58+
required: true
59+
60+
- type: textarea
61+
id: what-happened
62+
attributes:
63+
label: What happened?
64+
description: A clear and concise description of the bug.
65+
validations:
66+
required: true
67+
68+
- type: textarea
69+
id: expected
70+
attributes:
71+
label: Expected behavior
72+
validations:
73+
required: true
74+
75+
- type: textarea
76+
id: reproduction
77+
attributes:
78+
label: Minimal reproduction
79+
description: Link to a repo, gist, or stackblitz that reproduces the issue.
80+
validations:
81+
required: true
82+
83+
- type: textarea
84+
id: logs
85+
attributes:
86+
label: Logs / stack traces
87+
render: shell
88+
89+
- type: textarea
90+
id: env
91+
attributes:
92+
label: Environment
93+
description: OS, Node.js version, package manager, etc.
94+
placeholder: |
95+
- OS: macOS 14
96+
- Node: 20.10
97+
- Package manager: pnpm 9

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Question or Discussion
4+
url: https://github.com/josedacosta/tailwindcss-obfuscator/discussions
5+
about: Ask a question or start a discussion with the community.
6+
- name: Security Vulnerability
7+
url: https://github.com/josedacosta/tailwindcss-obfuscator/security/advisories/new
8+
about: Report a security issue privately via GitHub Security Advisories.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Feature Request
2+
description: Suggest an idea or improvement
3+
title: "[Feature]: "
4+
labels: ["enhancement", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for suggesting an improvement! Please fill in the sections below.
10+
11+
- type: checkboxes
12+
id: prerequisites
13+
attributes:
14+
label: Prerequisites
15+
options:
16+
- label: I have searched existing issues and discussions for similar requests.
17+
required: true
18+
19+
- type: textarea
20+
id: problem
21+
attributes:
22+
label: Problem statement
23+
description: What problem are you trying to solve? What is the current limitation?
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
id: proposal
29+
attributes:
30+
label: Proposed solution
31+
description: Describe the solution you would like to see.
32+
validations:
33+
required: true
34+
35+
- type: textarea
36+
id: alternatives
37+
attributes:
38+
label: Alternatives considered
39+
40+
- type: textarea
41+
id: context
42+
attributes:
43+
label: Additional context
44+
description: Add any other context, screenshots, or links here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Pull Request
2+
3+
## Summary
4+
5+
<!-- Briefly describe what this PR does and why -->
6+
7+
## Type of Change
8+
9+
<!-- Check all that apply -->
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] Documentation update
15+
- [ ] Refactor / internal improvement
16+
- [ ] CI / build / tooling change
17+
18+
## Related Issues
19+
20+
<!-- Link related issues, e.g. "Closes #123" -->
21+
22+
## Test Plan
23+
24+
<!-- How did you verify your change? -->
25+
26+
- [ ] Existing tests pass (`pnpm test`)
27+
- [ ] New tests added covering the change
28+
- [ ] Tested manually against at least one app in `apps/`
29+
30+
## Changeset
31+
32+
<!-- Run `pnpm changeset` if your change affects the published package -->
33+
34+
- [ ] A changeset entry has been added (or this PR doesn't require one)
35+
36+
## Checklist
37+
38+
- [ ] My code follows the project's code style (`pnpm lint && pnpm format`)
39+
- [ ] I have updated documentation where needed
40+
- [ ] My changes generate no new warnings
41+
- [ ] I have read the [Contributing Guide](../CONTRIBUTING.md)

0 commit comments

Comments
 (0)