-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(rollup-plugin-purgecss): convert to typescript
- convert to typescript - change tests
- Loading branch information
Showing
9 changed files
with
47 additions
and
39 deletions.
There are no files selected for viewing
9 changes: 4 additions & 5 deletions
9
packages/rollup-plugin-purgecss/__tests__/fixtures/ts-basic/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import atualA from '../../assets/actual_a.scss' | ||
import atualB from '../../assets/actual_b.scss' | ||
import atualC from '../../assets/actual_c.sass' | ||
import atualA from "../../assets/actual_a.scss"; | ||
import atualB from "../../assets/actual_b.scss"; | ||
import atualC from "../../assets/actual_c.sass"; | ||
|
||
|
||
export default atualA + atualB + atualC | ||
export default atualA + atualB + atualC; |
4 changes: 2 additions & 2 deletions
4
packages/rollup-plugin-purgecss/__tests__/fixtures/ts-output-function/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import '../../assets/actual_a.scss' | ||
import '../../assets/actual_b.scss' | ||
import "../../assets/actual_a.scss"; | ||
import "../../assets/actual_b.scss"; |
4 changes: 2 additions & 2 deletions
4
packages/rollup-plugin-purgecss/__tests__/fixtures/ts-output-path/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import '../../assets/actual_a.scss' | ||
import '../../assets/actual_b.scss' | ||
import "../../assets/actual_a.scss"; | ||
import "../../assets/actual_b.scss"; |
4 changes: 2 additions & 2 deletions
4
packages/rollup-plugin-purgecss/__tests__/fixtures/ts-output-true/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import '../../assets/actual_a.scss' | ||
import '../../assets/actual_b.scss' | ||
import "../../assets/actual_a.scss"; | ||
import "../../assets/actual_b.scss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import fs from "fs"; | ||
// import fs from "fs"; | ||
import path from "path"; | ||
import { rollup } from "rollup"; | ||
import purgecss from "./src/"; | ||
import purgecss from "./../src/"; | ||
|
||
const expectA = fs.readFileSync("__tests__/assets/expect_a.css").toString(); | ||
// const expectA = fs.readFileSync(path.resolve(__dirname, "assets/expect_a.css")).toString(); | ||
|
||
describe("rollup-plugin-purgecss", () => { | ||
it("remove unused css", async () => { | ||
const bundle = await rollup({ | ||
input: "__tests__fixtures/index.js", | ||
await rollup({ | ||
input: path.resolve(__dirname, "fixtures/basic/index.js"), | ||
plugins: [ | ||
purgecss({ | ||
content: ["__tests__/assets/test_a.html"], | ||
content: [path.resolve(__dirname, "assets/test_a.html")], | ||
output: path.resolve(__dirname, "temp/purged"), | ||
}), | ||
], | ||
}); | ||
|
||
const value = await bundle.generate({ format: "cjs" }); | ||
expect(value.output).toEqual(expectA); | ||
// const value = await bundle.generate({ format: "cjs" }); | ||
// expect(value.output).toEqual(expectA); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body{color: red;} | ||
|
||
a{color: green;}.used{color: blue;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters