Skip to content

Commit

Permalink
fix postcss plugin cwd for relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Dec 6, 2020
1 parent 2dbe502 commit a05e56c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/plugin-postcss/plugin.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const path = require('path');
const execa = require('execa');

module.exports = function postcssPlugin(_, options) {
return {
name: '@snowpack/postcss-transform',
async transform({fileExt, contents}) {
async transform({id, fileExt, contents}) {
const {input = ['.css'], config} = options;
if (!input.includes(fileExt) || !contents) return;

const flags = [];
if (config) flags.push(`--config ${config}`);

const {stdout} = await execa('postcss', flags, {
cwd: process.cwd(),
cwd: path.dirname(id),
input: contents,
});

Expand Down

1 comment on commit a05e56c

@vercel
Copy link

@vercel vercel bot commented on a05e56c Dec 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.