-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Original components class name mangling after build #192
Comments
Hi @Arif-un. This is actually a feature. Files are rewritten on purpose in a production build, because of the inconsistency when working with vite/reactjs implementations. Some of them (somehow) handle Stylify before the build, so all is mangled within the process before the JSX is converted and the CSS is processed correctly and some of them not, which leads to mangled CSS but not JSX templates (output). Run The mangling can be disabled by adding const stylifyPlugin = stylifyVite({
// ...
compiler: {
mangleSelectors: false
}
}); Could you please tell me from which page you came to that example? I will update the docs. |
Related: #155 |
There is an option Thanks |
Hi @Arif-un. In the end it was indeed a bug. And a good one :D. The jsx is now converted from I have fixed that https://github.com/stylify/packages/blob/master/packages/stylify/src/Compiler/defaultPreset.ts#L102. Back to your question. I have updated the React example https://stackblitz.com/edit/stylify-react-vite?file=src%2FApp.jsx,src%2FButton.jsx. So now, it is configured exactly as you mentioned:
To the configuration:
This had to be a default behavior, but it seems some updates (vite/react/something else) broke that. Could you please try it and let me know, if it works and if everything is ok now? I have also checked your example where you have tried to split the button using You can however configure some custom areas with the selectors areas option. |
Great @Machy8, It's working, Thanks. |
@Arif-un Thanks for the answer! I am happy that this library is helpful to you. If you have any other questions or found any other bugs, please let me know. |
For further reading:
|
Great 👌 |
Describe the bug
Declared component style with the class name, but when running the build command, it's changing the original React-Component file
Reproduction
In this sandbox, App.jsx has two classes (container, title), when I run the build command my original react components class names are getting mangled.
I want to keep short class name in production but not in dev.
https://stackblitz.com/edit/stylify-react-vite-o6zemm?file=src/App.jsx
Thanks
Logs
No response
System Info
The text was updated successfully, but these errors were encountered: