Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
broccoli-postcss-single
Advanced tools
Postcss compiler for Broccoli, operates on individual files.
The broccoli-postcss-single plugin runs your css
through postcss plugins of your choosing.
npm install --save-dev broccoli-postcss-single
Due to changes in the plugin API of Postcss V8 some plugins may need to be updated after upgrading Postcss. Otherwise, switching to Postcss V8 should be as simple as updating this package from V4 to V5, however compatibility is not guaranteed.
var compileCSS = require("broccoli-postcss-single");
var outputTree = compileCSS(inputTrees, inputFile, outputFile, options);
inputTrees
: An array of trees that specify the directories used by Broccoli. If you have a single tree, pass [tree]
.
inputFile
: Relative path of the main CSS file to process.
outputFile
: Relative path of the output CSS file.
options
:
cacheExclude
: An array of regular expressions that files and directories in an input node cannot pass in order to be included in the cache hash for rebuilds (blacklist).
cacheInclude
: An array of regular expressions that files and directories in an input node must pass (match at least one pattern) in order to be included in the cache hash for rebuilds (whitelist).
plugins
: An array of plugin objects to be used by Postcss (a minimum of 1 plugin is required). The supported object format is module
: the plugin module itself, and options
: an object of supported options for the given plugin.
There are two supported methods for defining plugins:
Object form
plugins: [
{
module: require("some-plugin"),
options: {
/* options for `some-plugin` */
},
},
];
Function form
plugins: [
require("some-plugin")({
/* options for `some-plugin` */
}),
require("another-plugin")({
/* options for `another-plugin` */
}),
];
map
: An object of options to describe how Postcss should handle source maps.
browsers
: An array of supported browsers following the browserslist format. These will be passed to the options of each postcss plugin. This can be overridden on a per plugin basis.
parser
: A function that parses different CSS syntax (optional). Use this if you’d like to parse a different syntax, such as Sass or Sugarcss, by passing in a custom function or node module reference.
/* Brocfile.js */
var compileCSS = require("broccoli-postcss-single");
var cssnext = require("cssnext");
var options = {
plugins: [
{
module: cssnext,
options: {
browsers: [
// this will override `options.browsers`
"> 1%",
"last 2 versions",
],
},
},
],
map: {
inline: true,
},
browsers: ["last 2 version"],
};
var outputTree = compileCSS(["styles"], "app.css", "app.css", options);
module.exports = outputTree;
The default list of file extensions for caching is set to .css, .scss, .sass, .less
for faster incremental builds. If you are using a parser or filetype not in the list you will want to add the file extension as a regex to the cacheInclude
option.
If you are using something like Tailwind or a postcss plugin with a config file that you would like to trigger a rebuild, you will need to update the options to cache JS files: cacheInclude: [/.*\.(css|scss|sass|less|js)$/],
.
If you are using something like PurgeCSS and would like postcss to rebuild when template files are updated, you will need to update the options to cache HBS files: cacheInclude: [/.*\.(css|scss|sass|less|hbs)$/],
. However, in most cases PurgeCSS should only be run for a production build and this shouldn't be necessary.
FAQs
Postcss compiler for Broccoli, operates on individual files.
The npm package broccoli-postcss-single receives a total of 19,374 weekly downloads. As such, broccoli-postcss-single popularity was classified as popular.
We found that broccoli-postcss-single 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.