From c6ad788020f93591e198ab3456c40b1f5329abda Mon Sep 17 00:00:00 2001 From: g45t345rt Date: Tue, 23 Mar 2021 19:43:05 -0400 Subject: [PATCH] tmp date fix (oops) --- src/index.ts | 7 ++++++- test/index.js | 10 +++++----- test/tests/styles2.css | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 test/tests/styles2.css diff --git a/src/index.ts b/src/index.ts index fc83ee4..2ce532a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,7 +67,12 @@ const postCSSPlugin = ({ sourceRelDir = path.relative(path.dirname(rootDir), sourceDir), isModule = sourceBaseName.match(/\.module$/), tmpDir = path.resolve(tmpDirPath, sourceRelDir), - tmpFilePath = path.resolve(tmpDir, `${sourceBaseName}.css`); + tmpFilePath = path.resolve( + tmpDir, + `${sourceBaseName}-tmp-${Date.now()}-${sourceExt.replace(".", "")}${ + isModule ? ".module" : "" + }.css` + ); await ensureDir(tmpDir); diff --git a/test/index.js b/test/index.js index 6e980ef..343f8e0 100644 --- a/test/index.js +++ b/test/index.js @@ -5,7 +5,7 @@ const autoprefixer = require("autoprefixer"), describe("PostCSS esbuild tests", () => { it("Works with basic CSS imports", (done) => { - test("tests/basic.ts") + test(["tests/basic.ts"]) .then((res) => { assert(res); done(); @@ -13,7 +13,7 @@ describe("PostCSS esbuild tests", () => { .catch(done); }); it("Works with preprocessors", (done) => { - test("tests/preprocessors.ts") + test(["tests/preprocessors.ts"]) .then((res) => { assert(res); done(); @@ -21,7 +21,7 @@ describe("PostCSS esbuild tests", () => { .catch(done); }); it("Works with CSS modules", (done) => { - test("tests/modules.ts") + test(["tests/modules.ts"]) .then((res) => { assert(res); done(); @@ -29,7 +29,7 @@ describe("PostCSS esbuild tests", () => { .catch(done); }); it("Works with CSS as entrypoint", (done) => { - test("tests/styles.css") + test(["tests/styles.css", "tests/styles2.css"]) .then((res) => { assert(res); done(); @@ -40,7 +40,7 @@ describe("PostCSS esbuild tests", () => { function test(entryPoint) { return build({ - entryPoints: [entryPoint], + entryPoints: entryPoint, bundle: true, outdir: "dist", plugins: [ diff --git a/test/tests/styles2.css b/test/tests/styles2.css new file mode 100644 index 0000000..65ec989 --- /dev/null +++ b/test/tests/styles2.css @@ -0,0 +1,6 @@ +.example { + display: grid; + transition: all 0.5s; + user-select: none; + background: linear-gradient(to bottom, white, black); +}