aodev / css-byebye Goto Github PK
View Code? Open in Web Editor NEWRemove the CSS rules that you don't want, with a list of selectors
License: MIT License
Remove the CSS rules that you don't want, with a list of selectors
License: MIT License
npm audit
it throwing the following issue (GHSA-566m-qj78-rww5):
Severity: moderate
Regular Expression Denial of Service in postcss - https://github.com/advisories/GHSA-566m-qj78-rww5
No fix available
node_modules/css-byebye/node_modules/postcss
css-byebye *
Depends on vulnerable versions of postcss
node_modules/css-byebye
when i use postcss8+css-byebye in my project, that warns:
css-byebye: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
would u pls fix it up?
I get the following error when trying to use the plugin: "Your current PostCSS version is 5.0.2, but css-byebye uses 4.1.16. Perhaps this is the source of the error below".
Do you plan to release a new version of the plugin?
This module should not wrap the PostCSS API, but instead expose itself as a processor that can be used in a pipeline along with other transforms:
var postcss = require('postcss');
var css = 'a { font-size: 12px; } .hello .h1 { background: red } .world { color: blue }';
var output = postcss([
require('css-byebye')({rulesToRemove: ['.world']}),
require('autoprefixer')
]).process(css).css;
// do whatever with output
You can do this easily via the new postcss.plugin()
API introduced in 4.1
, which enables us as plugin developers to develop consistent tools for the PostCSS ecosystem:
var postcss = require('postcss');
module.exports = postcss.plugin('css-byebye', function (opts) {
// use the options passed to you and return a transformation
return function (css) {
css.eachRule(function () { /* your logic here :) */ });
}
});
That way we can use css-byebye alongside other processors to transform CSS many times in memory. ๐
The current logic only uses walkRules
so it doesn't remove things like @font-face
, @charset
, etc.
Is it possible to parse a css file to retrieve the array of selectors?
I've got two css files where I'm trying to remove the duplicates.
Could be possible delete only the exact selector from the array? I mean, if rulestoRemove
contains #header
removes only the #header
selector and not #header li
.
It will be useful to delete empty selectors for example.
Is there a way to use this with postcss-loader in webpack 4?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.