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

Conversation

SergeAstapov
Copy link
Contributor

@SergeAstapov SergeAstapov commented Feb 22, 2022

opt-in to address #365 until ember-cli-styles has stable release.

This would allow you to specify in config/environment.js:

'ember-component-css': {
  patchClassicComponent: false
}

Avoid the deprecation Reopening the Ember.Component super class itself is deprecated if you do not use classic components (or the bindings on classic components, at least).

Similar to salsify/ember-css-modules#251 and mainmatter/ember-test-selectors#721.

@webark
Copy link
Owner

webark commented Feb 22, 2022

@SergeAstapov I can merge this. Just curious as to what your usage is without the initializer.

@SergeAstapov
Copy link
Contributor Author

@webark we've migrated almost all components to Glimmer and use helper similar to https://github.com/webark/ember-cli-styles/blob/main/packages/namespace/addon/helpers/style-namespace.js but much simpler:

import { helper } from '@ember/component/helper';
import podNames from 'ember-component-css/pod-names';

export default helper(function styleNamespace ([componentName]) {
    return podNames[componentName];
});

which was inspired by this comment #342 (comment) (or maybe another one but with the same idea behind)

@SergeAstapov
Copy link
Contributor Author

@webark moving forward we'll definitely migrate to ember-cli-styles or ember-css-modules but having such fix proposed here allows to decouple that effort from Ember v4 upgrade.

@webark
Copy link
Owner

webark commented Feb 22, 2022

ahh. Ok cool. Yea, ember-cli-styles uses the same kind of helper, just adds the namespace during build through an ast rather than needing to look it up through a dynamically generated file.

@webark webark merged commit 170ced0 into webark:master Feb 22, 2022
@webark
Copy link
Owner

webark commented Feb 22, 2022

I'll get a release out in the next couple of days

@SergeAstapov SergeAstapov deleted the opt-out-component-reopen branch February 22, 2022 04:58
@SergeAstapov
Copy link
Contributor Author

Thank you @webark! I'll submit PR adding this option info to the readme

@webark
Copy link
Owner

webark commented Feb 22, 2022

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants