Skip to content

Commit

Permalink
fix(url handler): working default assetDir
Browse files Browse the repository at this point in the history
...in other words - put assets from CSS URLs alongside CSS files for working default `publicPath`
  • Loading branch information
Anidetrix committed May 5, 2020
1 parent 60f9946 commit 7187a27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ validateMany("basic", [
assetFileNames: "[name][extname]",
},
files: [
"assets/bg.png",
"assets/bg.testing.regex.png",
"assets/bg1.png",
"assets/bg1.testing.regex.png",
"assets/bg2.testing.regex.png",
"assets/cat-2x.png",
"assets/cat-print.png",
"assets/cat.png",
"bg.png",
"bg.testing.regex.png",
"bg1.png",
"bg1.testing.regex.png",
"bg2.testing.regex.png",
"cat-2x.png",
"cat-print.png",
"cat.png",
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/loaders/postcss/url/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type UrlOptions = {
/**
* Directory path for outputted CSS assets,
* which is not included into resulting URL
* @default "assets"
* @default "."
* */
assetDir?: string;
/**
Expand Down Expand Up @@ -63,7 +63,7 @@ const plugin: postcss.Plugin<UrlOptions> = postcss.plugin(

const inline = options.inline ?? false;
const publicPath = options.publicPath ?? "./";
const assetDir = options.assetDir ?? "assets";
const assetDir = options.assetDir ?? ".";
const resolve = options.resolve ?? resolveDefault;
const alias = options.alias ?? {};
const placeholder =
Expand Down

0 comments on commit 7187a27

Please sign in to comment.