Skip to content

Commit 2afd213

Browse files
committed
fix: Must invalidate the handlebars template cache across processes.
The CSS Blocks class name strategy uses a random hash that is purposefully unstable across processes in order to prevent people from relying on class names generated by css blocks. This means that the persistent handlebars template cache must be invalidated across builds. Ideally this would only affect the templates that are ported to CSS Blocks, but the ember plugin API for ast transforms lacks the expressive power for that. Because of this, we might want to reconsider the unstable classname strategy in the future.
1 parent 6754102 commit 2afd213

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/@css-blocks/ember-cli/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const path = require("path");
3+
const process = require("process");
34

45
const { CSSBlocksAggregate, CSSBlocksAnalyze, Transport } = require("@css-blocks/broccoli");
56
const { GlimmerAnalyzer, GlimmerRewriter } = require("@css-blocks/glimmer");
@@ -294,6 +295,7 @@ module.exports = {
294295
},
295296

296297
optionsForCacheInvalidation() {
298+
let pid = process.pid; // Because of the per-process randomization of css block names.
297299
let aliases = this._options.aliases;
298300
let analysisOpts = this._options.analysisOpts;
299301
let optimization = this._options.optimization;
@@ -307,6 +309,7 @@ module.exports = {
307309
}
308310

309311
return {
312+
pid,
310313
aliases,
311314
analysisOpts,
312315
optimization,

0 commit comments

Comments
 (0)