1.3.0 • Published 1 year ago

postcss-classname-obfuscator v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

postcss-classname-obfuscator

This PostCSS plugin replaces CSS class names with hard-to-guess characters.

The .next folder may not work properly if present.
We are currently checking for bugs. Please let us know as soon as you figure out how to reproduce the bug.
Demo site: https://postcss-classname-obfuscator-demo.vercel.app/
Demo repository: https://github.com/minagishl/postcss-classname-obfuscator-demo

If you cannot access the site ./screenshot.png

.primary {
  color: var(--primary);
}

.secondary {
  color: var(--secondary);
}
.b6d946 {
  color: var(--primary);
}

.d6bdb8 {
  color: var(--secondary);
}

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-classname-obfuscator

Step 2: Check your project for existing PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: {
    autoprefixer: {},
+   'postcss-classname-obfuscator': {},
  },
};

Options

OptionTypeDefaultDescription
typestring"nextjs""nextjs" - Application-specific directories Only supported by Next.js
enablebooleantrueEnable or disable the obfuscation.
lengthnumber6Character length (max. 32 characters)length.
methodstring"random""random" or "none" obfuscation method for classes.
prefixstring""Prefix for custom properties.
suffixstring""Suffix for custom properties.
ignorestring[][]Array of custom properties to ignore.
outputstring""Obfuscated property list json file output destination
directorystring""Directory to replace obfuscated class names
new inputJsonstring""The json output by output is available.
ignoreRegexstring[][]Regex to ignore.
hashAlgorithmstring"sha256"Hash algorithm for obfuscation.
preRun() => Promise() => Promise.resolve()What to do before running the plugin
callBack() => voidfunction () {}Callback function to run after the plugin has finished running

License

This source code is released under the MIT license.

1.3.0

1 year ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago