Skip to content

Commit 28d622e

Browse files
Allow PostCSS config to handle string file paths
Gulp’s `gulp-postcss` uses Vinyl file objects but webpack’s `postcss-loader` uses string files
1 parent 0f89c56 commit 28d622e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

postcss.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const pseudoclasses = require('postcss-pseudo-classes')
99
*
1010
* @param {object} context - PostCSS context
1111
* @param {string} context.env - Browserslist environment
12-
* @param {import('vinyl')} context.file - File object
12+
* @param {string | import('vinyl')} [context.file] - File path or object
1313
*/
14-
module.exports = ({ env, file }) => {
15-
const { dir, name } = parse(file.path)
14+
module.exports = ({ env, file = '' }) => {
15+
const { dir, name } = parse(typeof file === 'object' ? file.path : file)
1616

1717
const plugins = [
1818
autoprefixer({ env })

0 commit comments

Comments
 (0)