Skip to content

Commit

Permalink
Allow to opt out of classic component patching
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAstapov authored and webark committed Feb 22, 2022
1 parent a39a813 commit 170ced0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,22 @@ module.exports = {
annotation: 'Merge (ember-component-css merge names with addon tree)'
});
}

let checker = new VersionChecker(this);
let ember = checker.forEmber();
let superTree = this._super.treeForAddon.call(this, tree);

// Allow to opt-out from automatic Component.reopen()
if (this.addonConfig.patchClassicComponent === false) {
superTree = new Funnel(superTree, {
exclude: [
'ember-component-css/initializers/component-styles.js'
],
annotation:
"Funnel (ember-component-css exclude addon/initializers/component-styles.js per config)"
});
}

if (ember.isAbove('3.6.0')) {
return new Funnel(superTree, {
exclude: ['ember-component-css/initializers/route-styles.js'],
Expand All @@ -151,6 +164,17 @@ module.exports = {
},

treeForApp: function(tree) {
// Allow to opt-out from automatic Component.reopen()
if (this.addonConfig.patchClassicComponent === false) {
tree = new Funnel(tree, {
exclude: [
"initializers/component-styles.js"
],
annotation:
"Funnel (ember-component-css exclude app/initializers/component-styles.js per config)"
});
}

let checker = new VersionChecker(this);
let ember = checker.forEmber();
if (ember.isAbove('3.6.0')) {
Expand Down

0 comments on commit 170ced0

Please sign in to comment.