Skip to content

Commit

Permalink
Merge pull request #270 from salsify/avoid-template-compilation-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman authored Mar 23, 2022
2 parents 084cd33 + b3aa7e7 commit c33a8f7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## Unreleased

## 2.0.1 (March 23, 2022)

### Fixed
- Avoid triggering (ember.js#19392)[https://github.com/emberjs/ember.js/issues/19392] when we produce synthetic class `AttrNode`s.

## 2.0.0 (November 22, 2021)

This major release of Ember CSS Modules primarily removes support for deprecated patterns and updates our minimum support for other elements of the ecosystem.
Expand Down
15 changes: 12 additions & 3 deletions packages/ember-css-modules/lib/htmlbars-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,18 @@ module.exports = class ClassTransformPlugin {

utils.pushAll(parts, this.localToPath(localClassAttr.value));
this.divide(parts, 'text');
node.attributes.unshift(
this.builders.attr('class', this.builders.concat(parts))
);

let newClassAttr = this.builders.attr('class', this.builders.concat(parts));
node.attributes.unshift(newClassAttr);

// In new-enough versions of Ember (>= 3.25 or so), we need to create a
// fake good-enough `loc` whose content will start with `class=` to avoid
// triggering https://github.com/emberjs/ember.js/issues/19392
if (typeof localClassAttr.loc.slice === 'function') {
newClassAttr.loc = localClassAttr.loc.slice({
skipStart: 'local-'.length,
});
}
}

localToPath(node) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-css-modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-css-modules",
"version": "2.0.0",
"version": "2.0.1",
"description": "CSS Modules for ambitious applications",
"scripts": {
"build": "ember build --environment=production",
Expand Down

0 comments on commit c33a8f7

Please sign in to comment.