diff --git a/test/cases/at-charset/a.css b/test/cases/at-charset/a.css new file mode 100644 index 00000000..f503561d --- /dev/null +++ b/test/cases/at-charset/a.css @@ -0,0 +1,11 @@ +@charset "utf-8"; + +@import "./ae.css"; +@import "./aa.css"; +@import "./ab.css"; +@import "./ac.css"; +@import "./ad.css"; + +body { + background: red; +} diff --git a/test/cases/at-charset/aa.css b/test/cases/at-charset/aa.css new file mode 100644 index 00000000..253ded4b --- /dev/null +++ b/test/cases/at-charset/aa.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.aa { + background: green; +} diff --git a/test/cases/at-charset/ab.css b/test/cases/at-charset/ab.css new file mode 100644 index 00000000..56d4d16d --- /dev/null +++ b/test/cases/at-charset/ab.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.ab { + background: green; +} diff --git a/test/cases/at-charset/ac.css b/test/cases/at-charset/ac.css new file mode 100644 index 00000000..1cf799c7 --- /dev/null +++ b/test/cases/at-charset/ac.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.ac { + background: green; +} diff --git a/test/cases/at-charset/ad.css b/test/cases/at-charset/ad.css new file mode 100644 index 00000000..a3af6572 --- /dev/null +++ b/test/cases/at-charset/ad.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.ad { + background: green; +} diff --git a/test/cases/at-charset/ae.css b/test/cases/at-charset/ae.css new file mode 100644 index 00000000..f001afd5 --- /dev/null +++ b/test/cases/at-charset/ae.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.ae { + background: green; +} diff --git a/test/cases/at-charset/b.css b/test/cases/at-charset/b.css new file mode 100644 index 00000000..10190b64 --- /dev/null +++ b/test/cases/at-charset/b.css @@ -0,0 +1,8 @@ +@charset "utf-8"; + +@import "./ba.css"; +@import "./bb.css"; + +body { + background: yellow; +} diff --git a/test/cases/at-charset/ba.css b/test/cases/at-charset/ba.css new file mode 100644 index 00000000..b7d79c83 --- /dev/null +++ b/test/cases/at-charset/ba.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.ba { + background: green; +} diff --git a/test/cases/at-charset/bb.css b/test/cases/at-charset/bb.css new file mode 100644 index 00000000..0fcba139 --- /dev/null +++ b/test/cases/at-charset/bb.css @@ -0,0 +1,5 @@ +@charset "utf-8"; + +.bb { + background: green; +} diff --git a/test/cases/at-charset/expected/main.css b/test/cases/at-charset/expected/main.css new file mode 100644 index 00000000..98abe50a --- /dev/null +++ b/test/cases/at-charset/expected/main.css @@ -0,0 +1,54 @@ +@charset "utf-8"; + +.ae { + background: green; +} + +@charset "utf-8"; + +.aa { + background: green; +} + +@charset "utf-8"; + +.ab { + background: green; +} + +@charset "utf-8"; + +.ac { + background: green; +} + +@charset "utf-8"; + +.ad { + background: green; +} + +@charset "utf-8"; + +body { + background: red; +} + +@charset "utf-8"; + +.ba { + background: green; +} + +@charset "utf-8"; + +.bb { + background: green; +} + +@charset "utf-8"; + +body { + background: yellow; +} + diff --git a/test/cases/at-charset/index.js b/test/cases/at-charset/index.js new file mode 100644 index 00000000..5337afb9 --- /dev/null +++ b/test/cases/at-charset/index.js @@ -0,0 +1,2 @@ +import "./a.css"; +import "./b.css"; diff --git a/test/cases/at-charset/webpack.config.js b/test/cases/at-charset/webpack.config.js new file mode 100644 index 00000000..cf55c08c --- /dev/null +++ b/test/cases/at-charset/webpack.config.js @@ -0,0 +1,18 @@ +import Self from "../../../src"; + +module.exports = { + entry: "./index.js", + module: { + rules: [ + { + test: /\.css$/, + use: [Self.loader, "css-loader"], + }, + ], + }, + plugins: [ + new Self({ + filename: "[name].css", + }), + ], +};