Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-prefixer

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-prefixer

postcss plugin to prefix all css selector classes and ids

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
increased by0.34%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-prefixer

License: MIT

A PostCSS plugin to prefix css selectors.

/* source css file */

#selector { /* content */ }

.selector { /* content */ }

.selector:hover { /* content */ }

.selector__element { /* content */ }
/* output css file prefixed with "prfx__" */

#prfx__selector { /* content */ }

.prfx__selector { /* content */ }

.prfx__selector:hover { /* content */ }

.prfx__selector__element { /* content */ }

Usage

npm i -D postcss postcss-prefixer or yarn add -D postcss postcss-prefixer

create a postcss.config.js with:

module.exports = {
  plugins: [
    require('postcss-prefixer')({ /* options */ })
  ]
}

Refer to PostCSS Usage on how to use it with your preferred build tool.

Example
const postcss = require('postcss');
const prefixer = require('postcss-prefixer');

const input = fs.readFileSync('path/to/file.css',  'utf-8');

const output = postcss([
  prefixer({
        prefix: 'prefix-',
        ignore: [ /selector-/, '.ignore', '#ignore' ]
    })
]).process(input);
Options
NameDescription
prefix (string)prefix value to be used
ignore (array)list of selectors to ignore, accepts regex

Credits

Plugin based on postcss-class-prefix create by thompsongl.

Keywords

FAQs

Package last updated on 05 Jun 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc