New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

minify-selectors

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minify-selectors - npm Package Compare versions

Comparing version 0.7.8 to 0.9.8

LICENSE

7

build/binary.js

@@ -41,2 +41,7 @@ const { Binary } = require('binary-install');

},
{
type: 'Darwin',
architecture: 'arm64',
binary: 'macos-arm64',
},
];

@@ -61,3 +66,3 @@

error(
`Unsupported platform: ${ type } ${ arch }.\nCurrently supported platforms are:\n\n${ cTable.getTable(SUPPORTED_PLATFORMS) }`
`Unsupported platform: ${ type } ${ arch }.\nCurrently supported platforms are:\n\n${ cTable.getTable(SUPPORTED_PLATFORMS) }\n\nPlease feel free to notify us by creating an issue here: ${ package.bugs.url }.`
);

@@ -64,0 +69,0 @@ };

14

package.json
{
"name": "minify-selectors",
"version": "0.7.8",
"version": "0.9.8",
"description": "Post-processor that minifies classes and IDs in CSS, HTML and Javascript files.",

@@ -10,3 +10,3 @@ "author": {

},
"license": "ISC",
"license": "Apache-2.0",
"main": "index.js",

@@ -16,3 +16,5 @@ "bin": "./build/run.js",

"postinstall": "node ./build/install.js",
"test": "echo \"Error: no test specified\" && exit 1"
"lint:clippy": "cargo clippy -- -A clippy::needless_return",
"lint:rustfmt": "cargo +nightly fmt --check",
"test": "cargo test"
},

@@ -28,4 +30,8 @@ "repository": {

"CSS",
"JS",
"HTML",
"minify",
"selectors"
"selectors",
"minifier",
"cli"
],

@@ -32,0 +38,0 @@ "bugs": {

# minify-selectors
Post-processor that minifies classes and IDs in CSS, HTML and Javascript files.
Post-processor that minifies classes and IDs selector names in CSS, HTML and Javascript files. Each unique identifier — and any subsequent occurances — is converted to an ultracompact CSS valid selector name.
Each unique identifier is assigned an index which is converted into an ultra compact CSS valid selector.
> **Please note:**
minify-selectors only supports regular CSS, HTML and JS files. minify-selectors should be one of the final steps in your build process — SASS/SCSS, LESS, Typescript, JQuery, Handlebars, etc. should be compiled or transpiled first into its respective vanilla form.
## Examples
CSS (source):
### CSS
```css
#page--default { … }
[id='page--default'] { … }
.sidebar, .site-nav { … }

@@ -17,5 +19,4 @@ .sidebar .search:focus-within { … }

CSS (output):
```css
#a { … }
[id='a'], { … }
.b, .c { … }

@@ -26,5 +27,5 @@ .b .d:focus-within { … }

HTML (source):
### HTML
```html
<main id="page--default">
<body id="page--default">
<nav class="site-nav">

@@ -36,8 +37,7 @@ <div class="search has-content">

</nav>
</main>
</body>
```
HTML (output):
```html
<main id="a">
<body id="a">
<nav class="c">

@@ -49,6 +49,6 @@ <div class="d a1">

</nav>
</main>
</body>
```
JS (source)
### JS
```js

@@ -60,3 +60,2 @@ for (let link of document.querySelectorAll('a.anchor')) {

JS (output)
```js

@@ -68,25 +67,48 @@ for (let link of document.querySelectorAll('a.Bd')) {

For a full outline of capabilities and current limitations, see [parse_selectors info](crates/parse_selectors/info.md)
For a full outline of capabilities and current limitations, see [parse_selectors/info.md](crates/parse_selectors/info.md)
## Usage
Install from npm
```shell
npm i minify-selectors
```
### CLI
Run within npm scripts or in command line
```shell
minify-selectors --input "example/dir/src" --output "example/dir/dist"
```
1. Install from npm:
```shell
npm i -g minify-selectors
```
minify-selectors only supports regular CSS, HTML and JS files. minify-selectors should be one of the final steps in your build process — SASS/SCSS, LESS, Typescript, JQuery, Handlebars, etc. should be processed first.
2. Run in command line:
```shell
minify-selectors --input "example/dir/src" --output "example/dir/dist"
```
### npm scripts
1. Install from npm:
```shell
npm i minify-selectors
```
2. Include minify-selectors in your package.json scripts:
```json
"scripts": {
"build": "npm run build:webpack && npm run build:minify-selectors",
"build:minify-selectors": "minify-selectors --input \"example/dir/src/\" --output \"example/dir/dist/\"",
"build:webpack": "webpack --config config/webpack-prod.config.js"
},
```
2. Run npm script:
```shell
npm run build
```
## Options
### CLI flags
| Flag | Description |
|-------|--------------|
|:------|:-------------|
| `--input` (or&nbsp;`-i`) | Directory or file to process. If a directory path is provided — any CSS, HTML and JS files in the given directory and sub-directories will be parsed. If only a filepath is provided — only the given file will be parsed. |
| `--output` (or&nbsp;`-o`) | Directory to ouput processed files to. Setting the output path to be the same as the input path will overwrite existing files. |
| `--alphabet` | Custom sequence of characters to use when encoding. <br><br>By default, selector names will be encoded using the following base 62 string: `"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"` |
| `--start-index` | Index to start incrementing and encoding from. <br><br>By default, this will begin from `0` (essentially `a` if using the default alphabet). |
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc