Skip to content

Commit ac1cf16

Browse files
committed
fix: Keep the filename convention of using *.block.css.
1 parent fa2a536 commit ac1cf16

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@types/chai": "^3.5.2",
2020
"@types/debug": "0.0.29",
2121
"@types/loader-utils": "^1.1.3",
22+
"@types/minimatch": "^2.0.29",
2223
"@types/mocha": "^2.2.41",
2324
"@types/node": "^8.0.0",
2425
"@types/prettier": "^1.8.0",

packages/@css-blocks/jsx/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"babel-types": "7.0.0-beta.3",
6161
"babylon": "7.0.0-beta.46",
6262
"debug": "^2.6.8",
63+
"minimatch": "^3.0.4",
6364
"object.values": "^1.0.4",
6465
"opticss": "^0.3.0"
6566
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import * as path from "path";
1+
import * as minimatch from "minimatch";
2+
const BLOCK_PATTERN = new minimatch.Minimatch("*.block.*", { matchBase: true });
23
export function isBlockFilename(filename: string): boolean {
3-
return path.parse(filename).ext === ".css";
4+
return BLOCK_PATTERN.match(filename);
45
}

packages/@css-blocks/jsx/test/analyzer/typed-file-analysis.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class Test {
1414

1515
@test "Is able to parse vanilla without a `jsx` extension."() {
1616
mock({
17-
"bar.css": `
17+
"bar.block.css": `
1818
:scope { color: blue; }
1919
.pretty { color: red; }
2020
.pretty[state|color=yellow] {
@@ -24,7 +24,7 @@ export class Test {
2424
});
2525

2626
return parse(`
27-
import bar from 'bar.css';
27+
import bar from 'bar.block.css';
2828
import objstr from 'obj-str';
2929
3030
let style = objstr({
@@ -44,7 +44,7 @@ export class Test {
4444

4545
@test "Is able to parse typescript"() {
4646
mock({
47-
"bar.css": `
47+
"bar.block.css": `
4848
:scope { color: blue; }
4949
.pretty { color: red; }
5050
.pretty[state|color=yellow] {
@@ -54,7 +54,7 @@ export class Test {
5454
});
5555

5656
return parse(`
57-
import bar from 'bar.css';
57+
import bar from 'bar.block.css';
5858
import objstr from 'obj-str';
5959
6060
function fooGood<T extends { x: number }>(obj: T): T {
@@ -84,7 +84,7 @@ export class Test {
8484

8585
@test "Is able to parse flow"() {
8686
mock({
87-
"bar.css": `
87+
"bar.block.css": `
8888
:scope { color: blue; }
8989
.pretty { color: red; }
9090
.pretty[state|color=yellow] {
@@ -94,7 +94,7 @@ export class Test {
9494
});
9595

9696
return parse(`
97-
import bar from 'bar.css';
97+
import bar from 'bar.block.css';
9898
import objstr from 'obj-str';
9999
100100
let color: string = "yellow";

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,10 @@
10701070
version "3.0.3"
10711071
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
10721072

1073+
"@types/minimatch@^2.0.29":
1074+
version "2.0.29"
1075+
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
1076+
10731077
"@types/mocha@^2.2.41":
10741078
version "2.2.48"
10751079
resolved "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab"

0 commit comments

Comments
 (0)