Socket
Socket
Sign inDemoInstall

normalize-selector

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    normalize-selector

Normalize CSS Selectors


Version published
Weekly downloads
1.4M
increased by4.32%
Maintainers
1
Install size
13.4 kB
Created
Weekly downloads
 

Package description

What is normalize-selector?

The normalize-selector npm package is designed to normalize CSS selectors by formatting them into a consistent structure. This can be particularly useful for CSS processing tasks, such as minification, linting, or when implementing CSS-in-JS solutions where consistent selector formatting is crucial. It helps in cleaning up and standardizing selectors by removing unnecessary whitespace, sorting pseudo-classes, and ensuring a uniform structure.

What are normalize-selector's main functionalities?

Normalization of CSS Selectors

This feature demonstrates how normalize-selector can take a messy CSS selector string with extra spaces and inconsistent formatting, and normalize it into a clean, standardized format. This is particularly useful for CSS optimization and ensuring consistency across a codebase.

"const normalize = require('normalize-selector');
const normalizedSelector = normalize('  ul  > li:first-child   ');
console.log(normalizedSelector); // Outputs: 'ul > li:first-child'"

Other packages similar to normalize-selector

Readme

Source

Normalize-Selector

Normalize CSS selectors.

Examples:

  • #foo>.bar -> #foo > .bar
  • #foo > .bar -> #foo > .bar
  • foo[ a = 'b' ] -> foo[a='b']

Tests

Run mocha tests on node.js with:

npm test

or:

node ./test/mocha/node-suite.js

rawgithub

View the browser suite directly on rawgithub

License

The code and all the documentation are released under the MIT license.

http://getify.mit-license.org/

Keywords

FAQs

Last updated on 10 Aug 2015

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