Skip to content

Commit 98d0e76

Browse files
Tim Lindvalltimlindvall
Tim Lindvall
authored andcommitted
fix: Exclude compiled blocks from vendor.css.
1 parent a745147 commit 98d0e76

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

packages/@css-blocks/ember/src/CSSBlocksTemplateCompilerPlugin.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface AdditionalFile {
2525
contents: string;
2626
}
2727
export const BLOCK_GLOB = "**/*.block.{css,scss,sass,less,styl}";
28+
export const COMPILED_BLOCK_GLOB = "**/*.compiledblock.css";
2829

2930
const debug = debugGenerator("css-blocks:ember");
3031

packages/@css-blocks/ember/src/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,22 @@ import type EmberAddon from "ember-cli/lib/models/addon";
1212
import type { AddonImplementation, ThisAddon, Tree } from "ember-cli/lib/models/addon";
1313
import type Project from "ember-cli/lib/models/project";
1414

15-
import { BLOCK_GLOB, CSSBlocksTemplateCompilerPlugin, EmberASTPluginEnvironment } from "./CSSBlocksTemplateCompilerPlugin";
15+
import { BLOCK_GLOB, COMPILED_BLOCK_GLOB, CSSBlocksTemplateCompilerPlugin, EmberASTPluginEnvironment } from "./CSSBlocksTemplateCompilerPlugin";
1616

1717
const debug = debugGenerator("css-blocks:ember");
1818

1919
type Writeable<T> = { -readonly [P in keyof T]: T[P] };
2020

21-
function withoutCssBlockFiles(tree: InputNode | undefined) {
21+
function withoutCssBlockFiles(tree: InputNode | undefined, excludeCompiledBlocks = false) {
2222
if (!tree) return tree;
23+
24+
const exclude = [ BLOCK_GLOB ];
25+
if (excludeCompiledBlocks) {
26+
exclude.push(COMPILED_BLOCK_GLOB);
27+
}
28+
2329
return funnel(tree, {
24-
exclude: [ BLOCK_GLOB ],
30+
exclude,
2531
});
2632
}
2733

@@ -94,7 +100,7 @@ const EMBER_ADDON: AddonImplementation<CSSBlocksAddon> = {
94100
// We compile CSS Block files in the template tree, so in the CSS Tree all
95101
// we need to do is prune them out of the build before the tree gets
96102
// built.
97-
return withoutCssBlockFiles(tree);
103+
return withoutCssBlockFiles(tree, true);
98104
},
99105

100106
postprocessTree(type, tree) {

0 commit comments

Comments
 (0)