New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

postcss-remove-global

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-remove-global

PostCSS plugin to remove :global identifier from stylesheets

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

postcss-remove-global Build Status

PostCSS plugin to remove :global identifier from your stylesheet files.

Support three cases

  • Remove :global as a single selector
:global {
    a { }
}
a { }
  • Remove :global as part of a selecotr
.root :global .text { margin: 0 6px; }
.root .text { margin: 0 6px; }
  • Remove :global as part of params of @keyframe
@keyframes :global(zoomIn) { }
@keyframes zoomIn { }

Usage

Use with PostCSS API

const postcss = require('postcss')
const removeGlobal = require('postcss-remove-global')

const css = postcss()
  .use(removeGlobal())
  .process(':global { a {color: gray(85); background-color: gray(10%, .25)}}')
  .css
console.log('css = ', css)
//= 'a {color: gray(85); background-color: gray(10%, .25)}'

const css2 = postcss([removeGlobal])
  .process('.root :global .text { margin: 0 6px; }')
  .css
console.log('css2 = ', css2)
//= '.root .text { margin: 0 6px; }'

const css3 = postcss([removeGlobal])
  .process('@keyframes :global(zoomIn) { }')
  .css
console.log('css3 = ', css3)
//= '@keyframes zoomIn { }'

Reference:https://github.com/princetoad/try-postcss/blob/master/src/Plugin/plugin-remove-global.js

Use gulp task runner

gulp.task('global', () => {
  return gulp.src('assets/*.css')
    .pipe(postcss([removeGlobal]))
    .pipe(gulp.dest('build/'))
})

Reference:https://github.com/princetoad/try-postcss/blob/master/gulpfile.js

Keywords

postcss

FAQs

Package last updated on 06 Mar 2018

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