import {dirname} from 'node:path'import {readFileSync} from 'node:fs'import {fileURLToPath} from 'node:url'import posthtml from 'posthtml'import postcss from 'posthtml-postcss'const postcssPlugins = []const postcssOptions = {}const filterType = /^text\/css$/const __filename = fileURLToPath(import.meta.url)const __dirname = dirname(__filename)const filePath = `${__dirname}/index.html`const html =
If you don't pass any arguments to posthtml-postcss, it will try to use your project's PostCSS configuration (see postcss-load-config).
Notice that we're setting the option from when calling process. posthtml-postcss forwards this to PostCSS, which is useful for syntax error messages. (postcss-cli and gulp-posthtml are setting from automatically.)