{"_id":"@aissab/esbuild-plugin-postcss2","name":"@aissab/esbuild-plugin-postcss2","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.4":{"name":"@aissab/esbuild-plugin-postcss2","version":"0.1.4","description":"Use postcss with esbuild - upgrade","repository":{"type":"git","url":"git+https://github.com/frappe/esbuild-plugin-postcss2.git"},"author":{"name":"Marton Lederer","email":"marton@lederer.hu"},"license":"MIT","private":false,"publishConfig":{"access":"public"},"scripts":{"build":"cross-env NODE_ENV=production node build.js","dev":"cross-env NODE_ENV=development node build.js","test":"yarn build && cd test && mocha 'index.js' --no-timeout --exit","fmt":"prettier --write .","fmt:check":"prettier --check ."},"gitHooks":{"pre-commit":"prettier --write . && git add -A"},"main":"dist/index.js","module":"dist/index.esm.js","types":"src/modules.d.ts","dependencies":{"autoprefixer":"^10.2.5","fs-extra":"^9.1.0","less":"^4.x","postcss-modules":"^4.3.1","resolve-file":"^0.3.0","sass":"^1.x","stylus":"^0.59.0","tmp":"^0.2.1"},"devDependencies":{"@types/chai":"^4.2.15","@types/fs-extra":"^9.0.9","@types/less":"^3.0.2","@types/mocha":"^8.2.2","@types/node":"^14.14.37","@types/sass":"^1.16.0","@types/stylus":"^0.48.33","@types/tmp":"^0.2.0","chai":"^4.3.4","cross-env":"^7.0.3","esbuild":"^0.11.2","mocha":"^8.3.2","normalize.css":"^8.0.1","postcss-import":"^14.0.2","prettier":"^2.2.1","typescript":"^4.2.3","yorkie":"^2.0.0"},"peerDependencies":{"less":"^4.x","postcss":"8.x","sass":"^1.x","stylus":"^0.x"},"bugs":{"url":"https://github.com/frappe/esbuild-plugin-postcss2/issues"},"homepage":"https://github.com/frappe/esbuild-plugin-postcss2#readme","gitHead":"0eb5a1561ce8f6e1cfe65b9bf7a92641d7875e0e","_id":"@aissab/esbuild-plugin-postcss2@0.1.4","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Mx9fU9vZcMeD7g5O3Du5r1GhVXZUb9wEwUQqT+pRk0o7BvV9qEJU0i8XpJ9SXWJlulmTSD41Y0eN0ympfszmfw==","shasum":"bb7cf0c77a0131641e262ec8eb02a4841c24e17a","tarball":"https://registry.npmjs.org/@aissab/esbuild-plugin-postcss2/-/esbuild-plugin-postcss2-0.1.4.tgz","fileCount":4,"unpackedSize":5521,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGvQmHrYCHMKp8ppjyDRWrfglrwQ7f6Xz2yWTtOspY3cAiB9uwZdDzX/1ZOdzj0lPfTOPqLiQXvzNpFTnLn4bi9bnQ=="}]},"_npmUser":{"name":"aissab","email":"aissa.berrachiche@gmail.com"},"directories":{},"maintainers":[{"name":"aissab","email":"aissa.berrachiche@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-plugin-postcss2_0.1.4_1686219932980_0.7228022791095148"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-08T10:25:32.916Z","0.1.4":"2023-06-08T10:25:33.110Z","modified":"2023-06-08T10:25:33.267Z"},"maintainers":[{"name":"aissab","email":"aissa.berrachiche@gmail.com"}],"description":"Use postcss with esbuild - upgrade","homepage":"https://github.com/frappe/esbuild-plugin-postcss2#readme","repository":{"type":"git","url":"git+https://github.com/frappe/esbuild-plugin-postcss2.git"},"author":{"name":"Marton Lederer","email":"marton@lederer.hu"},"bugs":{"url":"https://github.com/frappe/esbuild-plugin-postcss2/issues"},"license":"MIT","readme":"# esbuild-plugin-postcss2\n\nThis plugin is an optimized, type-friendly version of [esbuild-plugin-postcss](https://github.com/deanc/esbuild-plugin-postcss). It supports CSS preprocessors and CSS modules.\n\n## Install\n\n```sh\nyarn add -D esbuild-plugin-postcss2\n```\n\nor\n\n```sh\nnpm i -D esbuild-plugin-postcss2\n```\n\n## Usage\n\nAdd the plugin to your esbuild plugins:\n\n```js\nconst esbuild = require(\"esbuild\");\nconst postCssPlugin = require(\"esbuild-plugin-postcss2\");\n\nesbuild.build({\n  ...\n  plugins: [\n    postCssPlugin.default()\n  ]\n  ...\n});\n```\n\n### PostCSS plugins\n\nAdd your desired PostCSS plugin to the plugins array:\n\n```js\nconst autoprefixer = require(\"autoprefixer\");\n\nesbuild.build({\n  ...\n  plugins: [\n    postCssPlugin.default({\n      plugins: [autoprefixer]\n    })\n  ]\n  ...\n});\n```\n\n### CSS modules\n\nPostCSS modules are enabled by default. You can pass in a config or disable it with the `modules` field:\n\n```js\npostCssPlugin.default({\n  // pass in `postcss-modules` custom options\n  // set to false to disable\n  modules: {\n    getJSON(cssFileName, json, outputFileName) {\n      const path = require(\"path\");\n      const cssName = path.basename(cssFileName, \".css\");\n      const jsonFileName = path.resolve(\"./build/\" + cssName + \".json\");\n\n      fs.writeFileSync(jsonFileName, JSON.stringify(json));\n    }\n  }\n});\n```\n\nAs per standard any file having `module` before the extension (ie `somefile.module.css`) will be treated as a module.\nThe option `fileIsModule` allows to override this behavior.\n\n```js\npostCssPlugin.default({\n  // pass a custom `fileIsModule` option to tell whether a file should be treated as a module\n  // in this example we want everything to be a module except file finishing with `global.css`\n  fileIsModule: (filepath) => !filepath.endsWith(\".global.css\")\n});\n```\n\n### Preprocessors\n\nTo use preprocessors (`sass`, `scss`, `stylus`, `less`), just add the desired preprocessor as a `devDependency`:\n\n```sh\nyarn add -D sass\n```\n","readmeFilename":"README.md"}