Fix entry-point with date time on filename
This commit is contained in:
parent
6ab4b5fb2c
commit
3e3159278d
11
src/index.ts
11
src/index.ts
@ -73,13 +73,16 @@ const postCSSPlugin = ({
|
|||||||
const sourceRelDir = path.relative(path.dirname(rootDir), sourceDir);
|
const sourceRelDir = path.relative(path.dirname(rootDir), sourceDir);
|
||||||
const isModule = sourceBaseName.match(/\.module$/);
|
const isModule = sourceBaseName.match(/\.module$/);
|
||||||
const tmpDir = path.resolve(tmpDirPath, sourceRelDir);
|
const tmpDir = path.resolve(tmpDirPath, sourceRelDir);
|
||||||
const tmpFilePath = path.resolve(
|
|
||||||
|
let tmpFilePath = path.resolve(
|
||||||
tmpDir,
|
tmpDir,
|
||||||
`${sourceBaseName}-tmp-${Date.now()}-${sourceExt.replace(".", "")}${
|
`${Date.now()}-${sourceBaseName}.css`
|
||||||
isModule ? ".module" : ""
|
|
||||||
}.css`
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// When CSS is an entry-point we don't want to append Date.now()
|
||||||
|
if (args.kind === "entry-point")
|
||||||
|
tmpFilePath = path.resolve(tmpDir, `${sourceBaseName}.css`);
|
||||||
|
|
||||||
await ensureDir(tmpDir);
|
await ensureDir(tmpDir);
|
||||||
|
|
||||||
const fileContent = await readFile(sourceFullPath);
|
const fileContent = await readFile(sourceFullPath);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user