Socket
Socket
Sign inDemoInstall

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 classes and ids


Version published
Weekly downloads
12K
increased by5.31%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-prefixer Build Status

PostCSS plugin to prefix all classes and ids

Installation

Before using the plugin, make sure to have installed the PostCSS before:

npm install postcss

After installing postcss you can install the plugin:

npm install postcss-prefixer

How to use


var postcss = require('postcss'),
    prefixer = require('postcss-prefixer');

var cssFile = fs.readFileSync('path/to/file.css',  'utf-8').toString();

var output = postcss().use(
    prefixer({
        prefix: 'prefix-'
        ignore: [ /col-/, '.class-to-ignore', '#id-to-ignore' ]
    })
).process(cssFile);

Example

Before:

#my-id {
    color: green;
}
.my-class {
    color: green;
}
.my-class .another-class {
    box-sizing: border-box;
}
.component.is-active.sub-component.is-disabled {
    box-sizing: border-box;
}
.class-to-ignore {
    color: blue;
}

After:

#prefix-my-id {
    color: green;
}
.prefix-my-class {
    color: green;
}
.prefix-my-class .prefix-another-class {
    box-sizing: border-box;
}
.prefix-component.prefix-is-active.prefix-sub-component.prefix-is-disabled {
    box-sizing: border-box;
}
.class-to-ignore {
    color: blue;
}

Credits

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

Keywords

FAQs

Package last updated on 06 Jun 2017

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