Skip to content
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

Allow to opt out of classic component patching #376

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Changes from all 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
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