Skip to content

Commit

Permalink
refactor: rename atrule to at-rule
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Nov 19, 2020
1 parent f466a25 commit 78aa606
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ createICSSRules(
```

By default it will create pseudo selector rules (`:import` and `:export`). Pass
`atrule` for `mode` to instead generate `@icss-import` and `@icss-export`, which
`at-rule` for `mode` to instead generate `@icss-import` and `@icss-export`, which
may be more resilient to post processing by other tools.

## License
Expand Down
4 changes: 2 additions & 2 deletions src/extractICSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const getDeclsObject = (rule) => {
*
* @param {string} css
* @param {boolean} removeRules
* @param {auto|rule|atrule} mode
* @param {'auto' | 'rule' | 'at-rule'} mode
*/
const extractICSS = (css, removeRules = true, mode = "auto") => {
const icssImports = {};
Expand All @@ -42,7 +42,7 @@ const extractICSS = (css, removeRules = true, mode = "auto") => {
}

css.each((node) => {
if (node.type === "rule" && mode !== "atrule") {
if (node.type === "rule" && mode !== "at-rule") {
if (node.selector.slice(0, 7) === ":import") {
const matches = importPattern.exec(node.selector);

Expand Down
8 changes: 4 additions & 4 deletions test/createICSSRules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test("create empty @icss-import statement", () => {
"path/file": {},
},
{},
"atrule"
"at-rule"
)
).toEqual("@icss-import 'path/file'");
});
Expand All @@ -80,7 +80,7 @@ test("create @icss-import statement", () => {
},
},
{},
"atrule"
"at-rule"
)
).toEqual("@icss-import 'path/file' {\n e: f\n}");
});
Expand All @@ -93,7 +93,7 @@ test("create @icss-export statement", () => {
a: "b",
c: "d",
},
"atrule"
"at-rule"
)
).toEqual("@icss-export {\n a: b;\n c: d\n}");
});
Expand All @@ -109,7 +109,7 @@ test("create @icss-import and @icss-export", () => {
{
c: "d",
},
"atrule"
"at-rule"
)
).toEqual("@icss-import 'colors' {\n a: b\n}\n@icss-export {\n c: d\n}");
});
4 changes: 2 additions & 2 deletions test/extractICSS.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ test("not process at-rules when mode is pseudo", () => {
});
});

test("not process at-rules when mode is atrule", () => {
test("not process at-rules when mode is 'at-rule'", () => {
expect(
runExtract(
`
Expand All @@ -181,7 +181,7 @@ test("not process at-rules when mode is atrule", () => {
@icss-export { d: d}
`,
"atrule"
"at-rule"
)
).toEqual({
icssImports: {
Expand Down

0 comments on commit 78aa606

Please sign in to comment.