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

postcss-prefixwrap

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-prefixwrap

A PostCSS plugin that is used to wrap css styles with a css selector to constrain their affect on parent elements in a page.

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63K
increased by14.13%
Maintainers
1
Weekly downloads
 
Created
Source

PostCSS Prefix Wrap

Build Status NPM Version License: MIT

A PostCSS plugin that is used to wrap css styles with a css selector to constrain their affect on parent elements in a page.

Where do I start?

These instructions are only for this plugin, see PostCSS website for framework information.

1. Install the plugin.

npm install --save-dev postcss-prefixwrap

2. Add to your PostCSS configuration.

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var prefixwrap = require("postcss-prefixwrap"); // The require for PostCSS Prefix Wrap.

gulp.task("css", function () {
    var processors = [
        prefixwrap(".my-custom-wrap")
    ];
    return gulp.src("./src/*.css")
        .pipe(postcss(processors))
        .pipe(gulp.dest("./dest"));
});

The above example is using Gulp.js, and is based on https://github.com/postcss/gulp-postcss README.md.

3. Add the container to your markup.

<div class="my-custom-wrap">
<!-- Your existing markup. -->
</div>

4. View your css, now prefix wrapped.

Before

p {
  color: red;
}

body {
  font-size: 16px;
}

After

.my-custom-wrap p {
  color: red;
}

.my-custom-wrap {
  font-size: 16px;
}

Testing

See https://travis-ci.org/dbtedman/postcss-prefixwrap for CI results, run on each commit.

Static Analysis

Linting support provided by ESLint based on rules defined in .eslintrc.yml.

npm run test:lint

Unit Tests

Code is unit tested using MochaJS.

npm run test:unit

Releasing

Based on the NPM Publishing Guide, after updating the current version, run the following command:

npm publish

Created Down Under by Daniel Tedman and Jeff Teng.

Australia

FAQs

Package last updated on 19 Jul 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