Socket
Book a DemoInstallSign in
Socket

wrap-selectors

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wrap-selectors

Wrap CSS selectors up within a prefix and/or suffix

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

wrap-selectors

Wrap CSS selectors up within a prefix and/or suffix, for example:

/* this: */
@document wrap(.module-name) {
  .header {
    font-family: 'Helvetica Neue', sans-serif;
    font-weight: 100;
  }
}

/* becomes this: */
.module-name .header {
  font-family: 'Helvetica Neue', sans-serif;
  font-weight: 100;
}

Usage

wrap-selectors is a rework plugin, so you can just use it like so:

var wrap = require('wrap-selectors')
var rework = require('rework')
var fs = require('fs')

var css = fs.readFileSync(
  __dirname + '/index.css', 'utf8'
)

css = rework(css)
  .use(wrap())
  .toString()

console.log(css)

Here's a few more usage examples for you:

@document wrap(.prefix-&:hover) {
  .hello { color: blue }
}

@document wrap(.prefix:hover) {
  .hello { color: green }
}

@document wrap(.prefix-&) {
  .hello { color: red }
  span { font-weight: bold }
}

Which would result in this output:

.prefix-hello:hover { color: blue; }

.prefix:hover { color: green; }

.prefix-hello { color: red; }
.prefix span { font-weight: bold; }

Keywords

wrap

FAQs

Package last updated on 28 Feb 2014

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