Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@frappe/esbuild-plugin-postcss2
Advanced tools
Unfortunately I don't have time for this plugin. Please contact me if you'd like to take on this project.
This plugin is an optimized, type-friendly version of esbuild-plugin-postcss. It supports CSS preprocessors and CSS modules.
yarn add -D esbuild-plugin-postcss2
or
npm i -D esbuild-plugin-postcss2
Add the plugin to your esbuild plugins:
const esbuild = require("esbuild");
const postCssPlugin = require("esbuild-plugin-postcss2");
esbuild.build({
...
plugins: [
postCssPlugin.default()
]
...
});
Add your desired PostCSS plugin to the plugins array:
const autoprefixer = require("autoprefixer");
esbuild.build({
...
plugins: [
postCssPlugin.default({
plugins: [autoprefixer]
})
]
...
});
PostCSS modules are enabled by default. You can pass in a config or disable it with the modules
field:
postCssPlugin.default({
// pass in `postcss-modules` custom options
// set to false to disable
modules: {
getJSON(cssFileName, json, outputFileName) {
const path = require("path");
const cssName = path.basename(cssFileName, ".css");
const jsonFileName = path.resolve("./build/" + cssName + ".json");
fs.writeFileSync(jsonFileName, JSON.stringify(json));
}
}
});
As per standard any file having module
before the extension (ie somefile.module.css
) will be treated as a module.
The option fileIsModule
allows to override this behavior.
postCssPlugin.default({
// pass a custom `fileIsModule` option to tell whether a file should be treated as a module
// in this example we want everything to be a module except file finishing with `global.css`
fileIsModule: (filepath) => !filepath.endsWith(".global.css")
});
To use preprocessors (sass
, scss
, stylus
, less
), just add the desired preprocessor as a devDependency
:
yarn add -D sass
FAQs
Use postcss with esbuild
The npm package @frappe/esbuild-plugin-postcss2 receives a total of 6,848 weekly downloads. As such, @frappe/esbuild-plugin-postcss2 popularity was classified as popular.
We found that @frappe/esbuild-plugin-postcss2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.