Socket
Socket
Sign inDemoInstall

postcss-reduce-idents

Package Overview
Dependencies
5
Maintainers
8
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.1 to 5.0.2

8

dist/lib/keyframes.js

@@ -39,3 +39,3 @@ "use strict";

transform() {
let referenced = []; // Iterate each property and change their names
const referenced = new Set(); // Iterate each property and change their names

@@ -45,4 +45,4 @@ decls.forEach(decl => {

if (node.type === 'word' && node.value in cache) {
if (!~referenced.indexOf(node.value)) {
referenced.push(node.value);
if (!referenced.has(node.value)) {
referenced.add(node.value);
}

@@ -59,3 +59,3 @@

if (cached && cached.count > 0 && !!~referenced.indexOf(rule.params)) {
if (cached && cached.count > 0 && referenced.has(rule.params)) {
rule.params = cached.ident;

@@ -62,0 +62,0 @@ }

{
"name": "postcss-reduce-idents",
"version": "5.0.1",
"version": "5.0.2",
"description": "Reduce custom identifiers with PostCSS.",

@@ -10,7 +10,2 @@ "main": "dist/index.js",

],
"scripts": {
"prebuild": "del-cli dist",
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"",
"prepublish": "yarn build"
},
"keywords": [

@@ -30,3 +25,3 @@ "css",

"dependencies": {
"postcss-value-parser": "^4.1.0"
"postcss-value-parser": "^4.2.0"
},

@@ -45,3 +40,7 @@ "bugs": {

},
"gitHead": "28c247175032fa03f04911cde56ad82d74d211cc"
}
"scripts": {
"prebuild": "rimraf dist",
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
},
"readme": "# [postcss][postcss]-reduce-idents\n\n> Reduce [custom identifiers][idents] with PostCSS.\n\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-reduce-idents) do:\n\n```\nnpm install postcss-reduce-idents --save\n```\n\n\n## Example\n\n### Input\n\nThis module will rename custom identifiers in your CSS files; it does so by\nconverting each name to a index, which is then encoded into a legal identifier.\nA legal custom identifier in CSS is case sensitive and must start with a\nletter, but can contain digits, hyphens and underscores. There are over 3,000\npossible two character identifiers, and 51 possible single character identifiers\nthat will be generated.\n\n```css\n@keyframes whiteToBlack {\n 0% {\n color: #fff\n }\n to {\n color: #000\n }\n}\n\n.one {\n animation-name: whiteToBlack\n}\n```\n\n### Output\n\n```css\n@keyframes a {\n 0% {\n color: #fff\n }\n to {\n color: #000\n }\n}\n\n.one {\n animation-name: a\n}\n```\n\nNote that this module does not handle identifiers that are not linked together.\nThe following example will not be transformed in any way:\n\n```css\n@keyframes fadeOut {\n 0% { opacity: 1 }\n to { opacity: 0 }\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n```\n\nIt works for `@keyframes`, `@counter-style`, custom `counter` values and grid area definitions. See the\n[documentation][idents] for more information, or the [tests](src/__tests__) for more\nexamples.\n\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n\n## API\n\n### reduceIdents([options])\n\n#### options\n\n##### counter\n\nType: `boolean` \nDefault: `true`\n\nPass `false` to disable reducing `content`, `counter-reset` and `counter-increment` declarations.\n\n##### keyframes\n\nType: `boolean` \nDefault: `true`\n\nPass `false` to disable reducing `keyframes` rules and `animation` declarations.\n\n##### counterStyle\n\nType: `boolean` \nDefault: `true`\n\nPass `false` to disable reducing `counter-style` rules and `list-style` and `system` declarations.\n\n##### gridTemplate\n\nType: `boolean` \nDefault: `true`\n\nPass `false` to disable reducing `grid-template`, `grid-area` and `grid-template-areas` declarations.\n\n##### encoder\n\nType: `function` \nDefault: [`lib/encode.js`](https://github.com/cssnano/postcss-reduce-idents/blob/master/src/lib/encode.js)\n\nPass a custom function to encode the identifier with (e.g.: as a way of prefixing them automatically).\n\nIt receives two parameters:\n - A `String` with the node value.\n - A `Number` identifying the index of the occurrence.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[idents]: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident\n\n[postcss]: https://github.com/postcss/postcss\n"
}
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