3.0.0 • Published 6 years ago

postcss-globalize v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

postcss-globalize

npm version Build Status Coverage Status

If you are using postcss-modules this plugin will scope all @keyframes, .classes, and #ids as global by adding :global(). It will also scope selectors with animation or animation-name declarations with a :global scope.

Useage

const fs = require('fs');
const postcss = require('postcss');
const globalize = require('postcss-globalize');

/* styles.css

.class {
  margin:0;
  animation: test-keyframe 3s;
}

#id {
  margin:0;
}

@keyframes test-keyframe {}
*/

fs.readFile('styles.css', (err, css) => {
    postcss([globalize()])
      .process(css, { from: 'styles.css', to: 'output.css' })
      .then(result => fs.writeFile('output.css', result.css););
});

/* output.css

:global(.class) :global {
   margin:0;
   animation: test-keyframe 3s;
}

:global(#id) {
  margin:0;
}

 @keyframes :global(test-keyframe) {}
*/
3.0.0

6 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago