postcss-pseudoelements
PostCSS plugin to add single-colon CSS 2.1 syntax pseudo selectors (i.e. :before)
Last updated 9 years ago by sventschui .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install postcss-pseudoelements 
SYNC missed versions from official npm registry.

postcss-pseudoelements

postcss helper for pseudo element colons, it handles double -> single and single -> double.

Usage

Double to Single (default)

var pe = require('postcss-pseudoelements');
var postcss = require('postcss');
var options = {
	single: true, // default
	selectors: ['before','after','first-letter','first-line'], // default
};

var processor = postcss(pe(options));

console.log(processor.process('a:before {}').css) // outputs: a:before {}
console.log(processor.process('a::before {}').css) // outputs: a:before {}

Single to Double

var pe = require('postcss-pseudoelements');
var postcss = require('postcss');
var options = {
	single: false,
	selectors: ['before','after','first-letter','first-line'], // default
};

var processor = postcss(pe(options));

console.log(processor.process('a:before {}').css) // outputs: a::before {}
console.log(processor.process('a::before {}').css) // outputs: a::before {}

Options

single: Boolean

  • true (default) if you want to move from double colon to colon for backwards compatibility
  • false if you need double colons

selectors: Array of pseudo-element selectors to rewrite with single and double colons. Note that these values will be used in a regexp without escaping. Defaults to ['before','after','first-letter','first-line']

example selectors:

var options = {
  selectors: [
    'hover',
    'focus',
    'active',
    'after',
    'ms-expand',
    'not',
    'first-child',
    'last-child'
  ],
};

Defaults

var options = {
  single: true,
  [
    'before',
    'after',
    'first-letter',
    'first-line'
  ]
};

Current Tags

  • 5.0.0                                ...           latest (7 years ago)

8 Versions

  • 5.0.0                                ...           7 years ago
  • 4.0.0                                ...           8 years ago
  • 3.0.0                                ...           9 years ago
  • 2.2.0                                ...           9 years ago
  • 2.1.1                                ...           10 years ago
  • 2.1.0                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 5
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE