Skip to content

Commit c33a8f7

Browse files
authored
Merge pull request salsify#270 from salsify/avoid-template-compilation-warnings
2 parents 084cd33 + b3aa7e7 commit c33a8f7

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
66

77
## Unreleased
88

9+
## 2.0.1 (March 23, 2022)
10+
11+
### Fixed
12+
- Avoid triggering (ember.js#19392)[https://github.com/emberjs/ember.js/issues/19392] when we produce synthetic class `AttrNode`s.
13+
914
## 2.0.0 (November 22, 2021)
1015

1116
This major release of Ember CSS Modules primarily removes support for deprecated patterns and updates our minimum support for other elements of the ecosystem.

packages/ember-css-modules/lib/htmlbars-plugin/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,18 @@ module.exports = class ClassTransformPlugin {
142142

143143
utils.pushAll(parts, this.localToPath(localClassAttr.value));
144144
this.divide(parts, 'text');
145-
node.attributes.unshift(
146-
this.builders.attr('class', this.builders.concat(parts))
147-
);
145+
146+
let newClassAttr = this.builders.attr('class', this.builders.concat(parts));
147+
node.attributes.unshift(newClassAttr);
148+
149+
// In new-enough versions of Ember (>= 3.25 or so), we need to create a
150+
// fake good-enough `loc` whose content will start with `class=` to avoid
151+
// triggering https://github.com/emberjs/ember.js/issues/19392
152+
if (typeof localClassAttr.loc.slice === 'function') {
153+
newClassAttr.loc = localClassAttr.loc.slice({
154+
skipStart: 'local-'.length,
155+
});
156+
}
148157
}
149158

150159
localToPath(node) {

packages/ember-css-modules/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-css-modules",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "CSS Modules for ambitious applications",
55
"scripts": {
66
"build": "ember build --environment=production",

0 commit comments

Comments
 (0)