Socket
Socket
Sign inDemoInstall

postcss-obfuscate-custom-properties

Package Overview
Dependencies
4
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-obfuscate-custom-properties

This PostCSS plugin replaces the names of custom properties with hard-to-guess characters


Version published
Maintainers
1
Install size
9.44 kB
Created

Changelog

Source

[1.2.0] - 2024-01-18

Added

  • hashAlgorithm - Hash algorithm for obfuscation.

Changed

  • Upgrade Packages

Readme

Source

postcss-obfuscate-custom-properties

This plugin replaces the names of CSS custom properties with hard-to-guess strings.

:root {
  --primary: 240 5.9% 10%;
  --secondary: 240 4.8% 95.9%;
}
:root {
  --b6d946: 240 5.9% 10%;
  --f02024: 240 4.8% 95.9%;
}

Usage

Step 1: Install plugin:

npm  install  --save-dev  postcss  postcss-obfuscate-custom-properties

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: {
+       'postcss-obfuscate-custom-properties': {},
		autoprefixer: {}
	},
};

Options

OptionTypeDefaultDescription
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
speedPrioritybooleanfalseIgnore all regular expressions and execute.
ignoreRegexstring[][]Regex to ignore.
ignoreSelectorsstring[][]Array of selectors to ignore.
IgnoreSelectorsRegexstring[][]Regex to ignore selectors.
[new] 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.

Keywords

FAQs

Last updated on 17 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc