8000 fix: cssFiles keys now use the {packageName}/{pattern} format · fuse-box/fuse-box@3459180 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 3459180

Browse files
smitt04nchanged
authored andcommitted
fix: cssFiles keys now use the {packageName}/{pattern} format
1 parent fb107ef commit 3459180

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/quantum/core/CSSFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export class CSSFile {
2-
constructor(public name : string, public contents : string) {}
2+
constructor(public name : string, public contents : string, public packageName: string = 'default') {}
33
}

src/quantum/plugin/QuantumOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class QuantumOptions {
188188
}
189189
}
190190
public shouldGenerateCSS() {
191-
return this.css === true;
191+
return this.css === true || this.cssFiles;
192192
}
193193

194194
public getCleanCSSOptions() {

src/quantum/plugin/modifications/CSSModifications.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class CSSModifications {
2121
}
2222
const cssPath = args[0].value;
2323
const cssRaw = args[1].value;
24-
const cssFile = new CSSFile(cssPath, cssRaw);
24+
const cssFile = new CSSFile(cssPath, cssRaw, statement.file.packageAbstraction.name);
2525
const collection = this.getCSSCollection(core, cssFile);
2626
collection.add(cssFile);
2727
core.postTasks.add(() => {
@@ -56,8 +56,12 @@ export class CSSModifications {
5656

5757
private static getCSSGroup(core: QuantumCore, cssFile: CSSFile): string {
5858
for (let key in core.opts.getCSSFiles()) {
59-
const regex = string2RegExp(key);
60-
if (regex.test(cssFile.name)) {
59+
let [packageName, pattern] = key.split('/', 2);
60+
if (!pattern) {
61+
pattern = '*';
62+
}
63+
const regex = string2RegExp(pattern);
64+
if ((packageName === '*' || packageName === cssFile.packageName) && regex.test(cssFile.name)) {
6165
return key;
6266
}
6367
}

0 commit comments

Comments
 (0)
0