Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
esbuild-plugin-postcss2
Advanced tools
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 esbuild-plugin-postcss2 receives a total of 0 weekly downloads. As such, esbuild-plugin-postcss2 popularity was classified as not popular.
We found that esbuild-plugin-postcss2 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.