If you want to run post-css on the following arrangement:
postcss app/app.css -o app/app.bundle.css
Postcss-url will then save the copied assets to process.cwd(), which in this case is .. Not correct. It should copy the assets to ./app/${assetsPath}.
This fix makes it so the assets are correctly copied to the same folder (presumably inside of a assetsPath) when a to option exists. Otherwise, use the old cwd() behavior.
I'm not 100% sure what the intention of the original logic was, but it appeared to be guarding for when there was a missing to option. This will still preserve the original behavior when to is !existy and use process.cwd(). Apologies if this understanding is incorrect.
If you want to run post-css on the following arrangement:
postcss app/app.css -o app/app.bundle.css
Postcss-url will then save the copied assets to
process.cwd()
, which in this case is.
. Not correct. It should copy the assets to./app/${assetsPath}
.This fix makes it so the assets are correctly copied to the same folder (presumably inside of a
assetsPath
) when ato
option exists. Otherwise, use the old cwd() behavior.I'm not 100% sure what the intention of the original logic was, but it appeared to be guarding for when there was a missing
to
option. This will still preserve the original behavior whento
is !existy and use process.cwd(). Apologies if this understanding is incorrect.