Skip to content

Update concat strategy; Fix sourcemap support in Ember v2 pipeline #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@css-blocks/ember-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type Addon from "ember-cli/lib/models/addon";
import type { AddonImplementation, ThisAddon } from "ember-cli/lib/models/addon";
import Project from "ember-cli/lib/models/project";

import { CSSBlocksApplicationPlugin, CSSBlocksStylesProcessorPlugin } from "./brocolli-plugin";
import { CSSBlocksApplicationPlugin, CSSBlocksStylesProcessorPlugin } from "./broccoli-plugin";

interface AddonEnvironment {
parent: Addon | EmberApp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface AdditionalFile {
contents: string;
}
export const BLOCK_GLOB = "**/*.block.{css,scss,sass,less,styl}";
export const COMPILED_BLOCK_GLOB = "**/*.compiledblock.css";

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

Expand Down
14 changes: 10 additions & 4 deletions packages/@css-blocks/ember/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ import type EmberAddon from "ember-cli/lib/models/addon";
import type { AddonImplementation, ThisAddon, Tree } from "ember-cli/lib/models/addon";
import type Project from "ember-cli/lib/models/project";

import { BLOCK_GLOB, CSSBlocksTemplateCompilerPlugin, EmberASTPluginEnvironment } from "./CSSBlocksTemplateCompilerPlugin";
import { BLOCK_GLOB, COMPILED_BLOCK_GLOB, CSSBlocksTemplateCompilerPlugin, EmberASTPluginEnvironment } from "./CSSBlocksTemplateCompilerPlugin";

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

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

function withoutCssBlockFiles(tree: InputNode | undefined) {
function withoutCssBlockFiles(tree: InputNode | undefined, excludeCompiledBlocks = false) {
if (!tree) return tree;

const exclude = [ BLOCK_GLOB ];
if (excludeCompiledBlocks) {
exclude.push(COMPILED_BLOCK_GLOB);
}

return funnel(tree, {
exclude: [ BLOCK_GLOB ],
exclude,
});
}

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

postprocessTree(type, tree) {
Expand Down