esbuild-style-plugin
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -1,2 +0,2 @@ | ||
import { AcceptedPlugin } from 'postcss'; | ||
import { AcceptedPlugin, ProcessOptions } from 'postcss'; | ||
import { PluginBuild } from 'esbuild'; | ||
@@ -6,2 +6,5 @@ import CssModulesOptions from './postcssModulesOptions'; | ||
import { RenderOptions } from './utils'; | ||
interface PostCSS extends ProcessOptions { | ||
plugins: AcceptedPlugin[]; | ||
} | ||
interface PluginOptions { | ||
@@ -11,3 +14,3 @@ extract?: boolean; | ||
cssModulesOptions?: CssModulesOptions; | ||
postcss?: AcceptedPlugin[]; | ||
postcss?: PostCSS; | ||
postcssConfigFile?: string | boolean; | ||
@@ -14,0 +17,0 @@ renderOptions?: RenderOptions; |
@@ -155,3 +155,3 @@ var __create = Object.create; | ||
let mapping = { data: {} }; | ||
let plugins = options.postcss || []; | ||
let { plugins = [], ...processOptions } = options.postcss || {}; | ||
let injectMapping = false; | ||
@@ -164,3 +164,3 @@ let contents = ""; | ||
if (plugins.length > 0) { | ||
const result = await (0, import_postcss.default)(plugins).process(css, { from: args.path }); | ||
const result = await (0, import_postcss.default)(plugins).process(css, { ...processOptions, from: args.path }); | ||
css = result.css; | ||
@@ -187,7 +187,4 @@ watchFiles = [...watchFiles, ...getPostCSSWatchFiles(result)]; | ||
if (options.postcssConfigFile) { | ||
const { plugins } = await importPostcssConfigFile(options.postcssConfigFile); | ||
if (options.postcss) | ||
options.postcss = [...options.postcss, ...plugins]; | ||
else | ||
options.postcss = plugins; | ||
console.log(`Using postcss config file.`); | ||
options.postcss = await importPostcssConfigFile(options.postcssConfigFile); | ||
} | ||
@@ -194,0 +191,0 @@ build.onResolve({ filter: styleFilter }, onStyleResolve); |
{ | ||
"name": "esbuild-style-plugin", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Another esbuild plugin for your styling with CSS,SASS,LESS,STYLUS", | ||
@@ -47,2 +47,4 @@ "types": "./dist/index.d.ts", | ||
"postcss-preset-env": "^7.0.1", | ||
"postcss-scss": "^4.0.3", | ||
"postcss-strip-inline-comments": "^0.1.5", | ||
"sass": "^1.43.4", | ||
@@ -49,0 +51,0 @@ "stylus": "^0.55.0", |
@@ -46,3 +46,5 @@ # esbuild-style-plugin | ||
- `stylusOptions` <https://stylus-lang.com/docs/js.html> | ||
- `postcss` array of postcss accepted plugins | ||
- `postcss` | ||
- `plugins` array of postcss accepted plugins | ||
- `parser` | `syntax` parse source css - use with postcss-scss | ||
- `postcssConfigFile` absolute path to `postcss.config.js` or `true` for using root folder path | ||
@@ -49,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
21817
84
18
474