8000 feat: SassPlugin header option · fuse-box/fuse-box@e9f8409 · 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 e9f8409

Browse files
committed
feat: SassPlugin header option
1 parent ef7e577 commit e9f8409

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/core/BundleProducer.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ export class BundleProducer {
3636
}
3737

3838
public run(opts: { chokidar?: any, runType?: string }): Promise<BundleProducer> {
39+
console.log("RUN");
3940
if (opts) {
4041
this.chokidarOptions = opts.chokidar;
4142
}
43+
4244
/** Collect information about watchers and start watching */
4345
this.watch();
44-
46+
//this.runner = new BundleRunner(this.fuse);
47+
4548
return this.runner.run(opts).then(() => {
4649

4750
this.sharedEvents.emit("producer-done");
@@ -51,7 +54,10 @@ export class BundleProducer {
5154
return plugin.producerEnd(this);
5255
}
5356
});
54-
}).then(() => this);
57+
}).then(() => {
58+
// this.bundles = new Map<string, Bundle>();
59+
return this
60+
});
5561
}
5662

5763
public addUserProcessEnvVariables(data: any) {

src/plugins/stylesheet/SassPlugin.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface SassPluginOptions {
88
macros?: { [key: string]: string };
99
importer?: boolean | ImporterFunc;
1010
cache?: boolean;
11+
header?: string;
1112
indentedSyntax?: boolean,
1213
functions?: { [key: string]: (...args: any[]) => any }
1314
}
@@ -58,9 +59,13 @@ export class SassPluginClass implements Plugin {
5859
"~": Config.NODE_MODULES_DIR + "/",
5960
};
6061

62+
if (this.options.header) {
63+
file.contents = this.options.header + "\n" + file.contents;
64+
}
65+
6166
const options = Object.assign({
6267
data: file.contents,
63-
file: context.homeDir+"/"+file.info.fuseBoxPath,
68+
file: context.homeDir + "/" + file.info.fuseBoxPath,
6469
sourceMap: true,
6570
outFile: file.info.fuseBoxPath,
6671
sourceMapContents: true
@@ -90,7 +95,7 @@ export class SassPluginClass implements Plugin {
9095
let file = path.normalize(url);
9196

9297
if (context.extensionOverrides) {
93-
file = context.extensionOverrides.getPathOverride(file) || file;
98+
file = context.extensionOverrides.getPathOverride(file) || file;
9499
}
95100

96101
done({ file });

src/quantum/plugin/QuantumCore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export class QuantumCore {
9393
abstraction.quantumCore = this;
9494
this.producerAbstraction = abstraction;
9595
this.log.echoInfo("Abstraction generated");
96-
9796
await each(abstraction.bundleAbstractions, (bundleAbstraction: BundleAbstraction​​) => {
9897
return this.prepareFiles(bundleAbstraction);
9998
});
@@ -225,6 +224,7 @@ export class QuantumCore {
225224
if (globals) {
226225
for (let i in globals) { globalsName = globals[i]; }
227226
}
227+
//console.log("here", bundleAbstraction.packageAbstractions);
228228
bundleAbstraction.packageAbstractions.forEach(packageAbstraction => {
229229
packageAbstraction.fileAbstractions.forEach((fileAbstraction, key: string) => {
230230
let fileId = fileAbstraction.getFuseBoxFullPath();

0 commit comments

Comments
 (0)
0