Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
postcss-functions
Advanced tools
Readme
PostCSS plugin for exposing JavaScript functions.
npm install --save-dev postcss postcss-functions
import fs from 'fs';
import postcss from 'postcss';
import functions from 'postcss-functions';
const options = {
//options
};
const css = fs.readFileSync('input.css', 'utf8');
postcss()
.use(functions(options))
.process(css)
.then((result) => {
const output = result.css;
});
Example of a function call:
body {
prop: foobar();
}
functions
Type: Object
An object containing functions. The function name will correspond with the object key.
Example:
import postcssFunctions from 'postcss-functions';
import { fromString, fromRgb } from 'css-color-converter';
function darken(value, frac) {
const darken = 1 - parseFloat(frac);
const rgba = fromString(value).toRgbaArray();
const r = rgba[0] * darken;
const g = rgba[1] * darken;
const b = rgba[2] * darken;
return fromRgb([r,g,b]).toHexString();
}
postcssFunctions({
functions: { darken }
});
.foo {
/* make 10% darker */
color: darken(blue, 0.1);
}
glob
?Versions prior to 4.0.0 had a globbing feature built in, but I've since decided to remove this feature from postcss-functions
. This means one less dependency and a smaller package size. For people still interested in this feature, you are free to pair postcss-functions
with the globbing library of your choice and pass the import
ed JavaScript files to the functions
option as described above.
FAQs
PostCSS plugin for exposing JavaScript functions
The npm package postcss-functions receives a total of 149,458 weekly downloads. As such, postcss-functions popularity was classified as popular.
We found that postcss-functions 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.