-
-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature Request] Supporting new native CSS nesting
#20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TOO LONG MUST READ !!! 🤣🤣 |
Not related, but look at your hard work @soranoo , so satisfying 🚀 ![]() ![]() |
Any sample CSS(before obfuscated) inside the |
yaeh maybe However, u mean this? Just delete And this is the obfuscated version one: My config: module.exports = {
enable: true, // Enable or disable the plugin.
mode: "random", // Obfuscate mode, "random" or "simplify".
buildFolderPath: ".next", // Build folder of your project.
classConversionJsonFolderPath: "./css-obfuscator", // The folder path to store the before obfuscate and after obfuscated classes conversion table.
refreshClassConversionJson: false, // Refresh the class conversion JSON file.
classLength: 6, // Length of the obfuscated class name.
classPrefix: "n", // Prefix of the obfuscated class name.
classSuffix: "", // Suffix of the obfuscated class name.
classIgnore: ["dark", "light", "no-transition", "opa-hidden", "big", "small", /__.*/, /os-*/], // The class names to be ignored during obfuscation.
allowExtensions: [".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"], // The file extensions to be processed.
contentIgnoreRegexes: [/\.jsxs\)\("\w+"/g], // The regexes to match the file content to be ignored during obfuscation.
whiteListedFolderPaths: [], // Only obfuscate files in these folders
blackListedFolderPaths: ["./.next/cache"], // Don't obfuscate files in these folders
enableMarkers: false, // Enable or disable the obfuscate marker classes.
markers: ["obf"], // Classes that indicate component(s) need to obfuscate.
removeMarkersAfterObfuscated: true, // Remove the obfuscation markers from HTML elements after obfuscation.
removeOriginalCss: true, // Delete original CSS from CSS files if it has a obfuscated version.
generatorSeed: "84817818898", // The seed for the random generator.
//! Experimental feature (Alpha)
enableJsAst: false, // Whether to obfuscate JS files using abstract syntax tree parser (Experimental feature)
logLevel: "info", // Log level
}; Note: Sorry I forgot that I had changed the class |
No, I need the stripped CSS file, like the second file u provided |
U mean the minified one?? but no obfuscated? and would u like me to turn the |
I'll give u two Obfuscation disable + CSS nesting plugin enable: Obfuscation disable + CSS nesting plugin disable: Sorry but I just keep the |
Btw, in your Line 3: Line 41: Line 93: Line 95: Line 209, 228, 377: Line 209: Line 212: Line 313: Line 319: Line 369: Line 414: Line 428: Line 431: Line 457: Actually, I was going to send you this from the Waiting for the next patch 😶🌫️ |
Please open a new issue if you are going to mention ANYthing not relevant to the current issue!! |
Since I'm not a |
An issue is something like a topic. It is not relevant whether you are a package creator, It is important to the open-source community!!! |
Checkout #21 |
Okay... |
Case 1: Can't reproduce |
It works @soranoo 🚀 |
|
Uh oh!
There was an error while loading. Please reload this page.
Checklist
Is your feature request related to a problem? Please describe.
Maybe not, just a
feature request
.Describe the solution you'd like
Supporting obfuscate new
native CSS nesting
.Describe alternatives you've considered
1.
first,2.
later.Additional context
👀Version
v2.2.7
THIS POST HAS 02 BIG SECTIONS:
1. With
CSS nesting plugin *before* Tailwind
enabled.✅
next-css-obfuscator
work with these plugin enabled! (but there's still a bug which will not replaced the obfuscated class)2. With
CSS nesting plugin *before* Tailwind
disabled.⛔
next-css-obfuscator
does not work when not enable these plugin! (I can't capture the log cuz it's too long)So, what is that plugin?
🐽 1. When you using
CSS Nesting
in NextJs with TailwindCSS, you will receive a notification like this in thelog
terminal:And in the instruction link it provides, follow it, and you will get results like this in
postcss.config.js
:Now
CSS Nesting
in yourglobal.css
file will behave much like.sass
afternpm run build
. That means that even though existing CSS supportsnative CSS nesting
, TailwindCSS will still convert it tonormal CSS
.🐽 2. But if you do nothing, just ignore it, it's still works (cuz it became native now), but everytime you
save
the file, TailwindCSS will yell the abovewarning
Before going to the
Big sections
, let's explain a bit.✨ Main point:
Example TSX:
👉 In fact, CSS already supports
nesting
natively in the form ofnesting selector
:&
like below (ref):👉 But recently (I don't know when), CSS has supported
without nesting selector
(ref):Hmmm, except something like
:hover
,::before
,::after
maybe, I tried and it didn't work without&
in front. (I didn't try with:is
cuz I can't think of a suitable case)👉 On the other hand, there exists something called
CSS Combinators
:+
(ref)Okay, maybe enough...
🚀 1. With
CSS nesting plugin *before* Tailwind
ENABLED.IMPORTANT: it appears that
TailwindCSS
automatically converts thesenative CSS nesting
tonormal CSS
(without nesting) viaPostCSS
, even though it doesn't need to be done to run normally(as evidenced by
run dev
, or disablenext-css-obfuscator
plugin andrun build + run start
).Obfuscated ✅:
conversion.json
Not replaced ⛔:
output .css file
withnext-css-obfuscator
pluginenable
:Please ignore the red comment, it seems to be normal behavior in
production
output .css file
withnext-css-obfuscator
plugindisable
:🚀 2. With
CSS nesting plugin *before* Tailwind
DISABLED.next-css-obfuscator
plugin simply doesn't works whenenabled
.But when disable
next-css-obfuscator
:This is the
output .css file
:Which truly a
native CSS nesting
, but when inproduction
, it's still yell:However, that's just a
warning
not anerror
, the build process still successfully!In conclusion, I think for now you should only focus on fixing part
1.
, as for part2.
, wait until TW and NextJs supportnative CSS nesting
then you can fix it laterThe text was updated successfully, but these errors were encountered: