Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
postcss-finding-dead-css
Advanced tools
Readme
PostCSS plugin that help identifying the dead code. Idea. Only my plugin uses only the css border-image property.
# the plugin
yarn add -D postcss-finding-dead-css
#or npm install --save-dev postcss-finding-dead-css
body {
margin: 0;
}
.alredy-use-border-image {
border-image: linear-gradient(red, yellow) 10;
}
body {
margin: 0;
border-image-source: url('/cssdead?data=%7B%22selector%22:%22body%22,%22startLine%22:1,%22startColumn%22:1%7D&file=/home/mur/github/postcss-finding-dead-css/example/readme/input.css');
}
.alredy-use-border-image {
border-image: linear-gradient(red, yellow) 10;
}
// Node.js 8.x
const { readFileSync, writeFileSync } = require("fs");
const { resolve } = require("path");
const postcss = require("postcss");
const postcssDeadCss = require("postcss-finding-dead-css");
const [from, to] = ["./input.css", "./output.css"].map(f =>
resolve(__dirname, f)
);
const CSS = readFileSync(from);
const PLUGINS = [
postcssDeadCss({
// deadApiUrl: "http://my-analytic.server.com/cssdead", // default '/cssdead'
// url({selector, startLine, startColumn, file}) { // custom url
// return encodeURI(
// `${this.deadApiUrl}?data=${JSON.stringify({
// selector,
// startLine,
// startColumn
// })}&file=${file}`
// );
// }
})
];
(async () => {
try {
const { css, messages } = await postcss(PLUGINS).process(CSS, { from, to });
messages
.filter(({ type }) => type === "warning")
.map(msg => console.log(msg.toString()));
console.log(css);
writeFileSync(to, css);
} catch (e) {
console.error(e);
}
})();
deadApiUrl
, type: String
, required: false
default: '/cssdead'
Url to back-end api, I send two parametrs type
and file
type
- has json { selector, startLine, startColumn }
file
- path to source css file
url
, type: Function
, required: false
This function help you customize url generation
// Node.js 8.x
// example get middlewares:
const {getMiddleware} = require('postcss-finding-dead-css');
const {middlewareCheckDead, middlewareStat} = getMiddleware(options);
// Express.js
const app = express();
app.get(options.deadApiUrl, middlewareCheckDead);
{
deadApiUrl: '/custom/path', // defualt: '/cssdead'
statApiUrl: '/custom/path/stat' // defualt: '/getStat'
}
FAQs
PostCSS plugin that help identifying the dead code
The npm package postcss-finding-dead-css receives a total of 0 weekly downloads. As such, postcss-finding-dead-css popularity was classified as not popular.
We found that postcss-finding-dead-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.