-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
classes applyed to components changes with production build #137
Comments
Class names are prefixed as a unique identifier and can change in both development and production mode. That means you can't use css files (be it css, scss, ...) to customize Alyle UI components. There are other ways to customize Alyle UI components. You can add styles to themes or add styles to the component. Styles must be added directly to a ts file: import { STYLES as SLIDER_STYLES } from '@alyle/ui/slider';
import {
STYLES as CROPPER_STYLES,
LyImageCropper,
ImgCropperConfig,
ImgCropperEvent,
ImgCropperErrorEvent
} from '@alyle/ui/image-cropper';
const STYLES = (_theme: ThemeVariables, ref: ThemeRef) => {
ref.renderStyleSheet(SLIDER_STYLES);
ref.renderStyleSheet(CROPPER_STYLES);
const slider = ref.selectorsOf(SLIDER_STYLES);
const cropper = ref.selectorsOf(CROPPER_STYLES);
return {
root: lyl `{
${cropper.root} {
max-width: 320px
height: 320px
}
${cropper.area} {
// styles for cropper area
}
}`,
sliderContainer: lyl `{
position: relative
${slider.root} {
position: absolute
left: 0
right: 0
margin: auto
top: -32px
}
}`,
slider: lyl `{
padding: 1em
}`
};
};
@Component({
...
providers: [
StyleRenderer
]
})
export class CropperDialog implements WithStyles, AfterViewInit {
readonly classes = this.sRenderer.renderSheet(STYLES, 'root');
About Customization: |
Tnx for the explanation , one more question
where the keys in this object are coming from? |
Yes, they are keys that can be created with any name to use in components, for example: <div [className]="classes.sliderContainer">
<div [className]="classes.slider">
|
How can you do the same for a hover effect? |
I think it would be something like this but I am not sure and have not tested it.
|
Thanks a lot! |
Bug, feature request, or proposal:
I am not sure if this is a bug or a mistake on my side!
What is the expected behavior?
components have the same classes in
--prod
build that they have in development enviromentWhat is the current behavior?
classes on components are changed in production
Which versions of Angular, AlyleUI, OS, TypeScript, browsers are affected?
Version of
@alyle/ui@
: ^10.3.0Example
I had this styles for my image cropper
With this html
I added the
custom-cropper
class so that my coworker can style the component as needed, this worked just fine in development environment, but after we deployed the code to production--prod
this custom styles stopped workingmy local dev run has these classes :
LyImageCropper-root-af cropper-ab
but the prod run has these :af ab
?? what am I missing here?https://stackoverflow.com/questions/64569216/customizing-alyle-ui-component-styles
The text was updated successfully, but these errors were encountered: