You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visit the [GitHub Page](https://github.com/soranoo/next-css-obfuscator/) for better reading experience.
11
+
---
12
+
13
+
Visit the [GitHub Page](https://github.com/soranoo/next-css-obfuscator/) for better reading experience and latest docs. 😎
14
+
15
+
---
16
+
11
17
12
18
### 🎉 Version 2.1.0 has NOW been released 🎉
13
-
Shout out to [hoangnhan2ka3](https://github.com/hoangnhan2ka3) for providing a wonderful [issue](https://github.com/soranoo/next-css-obfuscator/issues/6) report.
19
+
Shout out to [hoangnhan2ka3](https://github.com/hoangnhan2ka3) for providing a 💪wonderful [issue](https://github.com/soranoo/next-css-obfuscator/issues/6) report and a demo site.
14
20
15
-
#### Changes:
21
+
#### 📌 Changes
16
22
- Much Much Much better quality of CSS selector obfuscation
17
23
- Delete original CSS automatically after obfuscation (only apply at full obfuscation)
18
24
- Support TailwindCSS Universal Selector (eg. `*:pt-4`)
19
25
- More tests
20
26
21
-
###Configuration Changes:
27
+
#### 📌 Configuration Changes
22
28
- Removed `customTailwindDarkModeSelector` option, the dark mode selector will be automatically obfuscated at full obfuscation.
23
29
- Merged `includeAnyMatchRegexes` and `excludeAnyMatchRegexes` options into `whiteListedFolderPaths` and `blackListedFolderPaths` options. (Directly move the regexes to the `whiteListedFolderPaths` and `blackListedFolderPaths` options)
24
30
- Added `removeOriginalCss` option, default to `false`. Set to `true` to delete original CSS from CSS files if it has a obfuscated version.
@@ -27,7 +33,7 @@ Visit the [GitHub Page](https://github.com/soranoo/next-css-obfuscator/) for bet
27
33
### 💥 Version 2 (Major Update)
28
34
This version is deeply inspired by [PostCSS-Obfuscator](https://github.com/n4j1Br4ch1D/postcss-obfuscator). Shout out to [n4j1Br4ch1D](https://github.com/n4j1Br4ch1D) for creating such a great package and thank you [tremor](https://github.com/tremorlabs) for sponsoring this project.
29
35
30
-
#### Changes:
36
+
#### 📌 Changes
31
37
- Support basic partial obfuscation
32
38
- Support TailwindCSS Dark Mode
33
39
- New configuration file `next-css-obfuscator.config.cjs`
@@ -36,7 +42,7 @@ Visit the [GitHub Page](https://github.com/soranoo/next-css-obfuscator/) for bet
36
42
- More tests
37
43
- Better CSS parsing
38
44
39
-
### Migration Guide:
45
+
### 📚 Migration Guides
40
46
-[Migrate from version 1.x to 2.x](docs/upgrade-to-v2.md)
41
47
42
48
@@ -71,6 +77,7 @@ Give me a ⭐ if you like it.
71
77
-[⭐ TODO](#-todo)
72
78
-[🐛 Known Issues](#-known-issues)
73
79
-[💖 Sponsors](#-sponsors)
80
+
-[🦾 Special Thanks](#-special-thanks)
74
81
-[🤝 Contributing](#-contributing)
75
82
-[📝 License](#-license)
76
83
-[☕ Donation](#-donation)
@@ -215,6 +222,9 @@ For convenience, you may update your build script to:
215
222
216
223
to make sure the build is always obfuscated and no need to run `obfuscate-build` manually.
217
224
225
+
> [!NOTE]\
226
+
> It is a good idea to add the `/css-obfuscator` folder to `.gitignore` to prevent the convertion table from being uploaded to the repository.
227
+
218
228
#### Partially obfuscate
219
229
To partially obfuscate your project, you have to add the obfuscate marker class to the components you want to obfuscate.
220
230
@@ -260,9 +270,11 @@ module.exports = {
260
270
/\.next\/server\/pages\/api/,
261
271
/_document..*js/,
262
272
/_app-.*/,
263
-
]
273
+
/__.*/, // <= maybe helpful if you are using Next.js Lcal Fonts [1*]
274
+
],
264
275
};
265
276
```
277
+
[*1] See this [comment](https://github.com/soranoo/next-css-obfuscator/issues/6#issuecomment-1919495298)
266
278
267
279
It may not be the best setting but it works for me. :)
268
280
@@ -278,11 +290,11 @@ It may not be the best setting but it works for me. :)
278
290
|classLength|number|5|The length of the obfuscated class name if in random mode.|
279
291
|classPrefix|string|""|The prefix of the obfuscated class name.|
280
292
|classSuffix|string|""|The suffix of the obfuscated class name.|
281
-
|classIgnore|(string | Regex)[ ]|[ ]|The class names to be ignored during obfuscation.|
293
+
|classIgnore|(string \| Regex)[ ]|[ ]|The class names to be ignored during obfuscation.|
282
294
|allowExtensions|string[ ]|[".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"]|The file extensions to be processed.|
283
-
|contentIgnoreRegexes|RegExp[ ]|[]|The regexes to match the content to be ignored during obfuscation.|
284
-
|whiteListedFolderPaths|(string | Regex)[ ]|[ ]|The folder paths/Regex to be processed. Empty array means all folders will be processed.|
285
-
|blackListedFolderPaths|(string | Regex)[ ]|[ ]|The folder paths/Regex to be ignored.|
295
+
|contentIgnoreRegexes|RegExp[ ]|[/\.jsxs\)\("\w+"/g]|The regexes to match the content to be ignored during obfuscation.|
296
+
|whiteListedFolderPaths|(string \| Regex)[ ]|[ ]|The folder paths/Regex to be processed. Empty array means all folders will be processed.|
297
+
|blackListedFolderPaths|(string \| Regex)[ ]|[ ]|The folder paths/Regex to be ignored.|
286
298
|enableMarkers|boolean|false|Enable or disable the obfuscation markers.|
287
299
|markers|string[ ]|[ ]|Classes that indicate component(s) need to obfuscate.|
288
300
|removeMarkersAfterObfuscated|boolean|true|Remove the obfuscation markers from HTML elements after obfuscation.|
@@ -303,15 +315,16 @@ module.exports = {
303
315
classSuffix: "", // Suffix of the obfuscated class name.
304
316
classIgnore: [], // The class names to be ignored during obfuscation.
305
317
allowExtensions: [".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"], // The file extensions to be processed.
306
-
contentIgnoreRegexes: [], // The regexes to match the file content to be ignored during obfuscation.
318
+
contentIgnoreRegexes: [
319
+
/\.jsxs\)\("\w+"/g, // avoid accidentally obfuscate the HTML tag
320
+
], // The regexes to match the file content to be ignored during obfuscation.
307
321
308
322
whiteListedFolderPaths: [], // Only obfuscate files in these folders
309
323
blackListedFolderPaths: ["./.next/cache"], // Don't obfuscate files in these folders
310
324
enableMarkers:false, // Enable or disable the obfuscate marker classes.
311
325
markers: ["next-css-obfuscation"], // Classes that indicate component(s) need to obfuscate.
312
326
removeMarkersAfterObfuscated:true, // Remove the obfuscation markers from HTML elements after obfuscation.
313
327
removeOriginalCss:false, // Delete original CSS from CSS files if it has a obfuscated version.
314
-
315
328
logLevel:"info", // Log level
316
329
};
317
330
```
@@ -377,6 +390,7 @@ Since the original CSS may referenced by other components not included in the ob
Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please fork the repository and run `npm run test` before submit a pull request.
0 commit comments