-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
Css class got duplicated if @import sytnax is used #1047
Comments
Do not use css |
I want to documented that |
I'm interested in understanding this as well. I've been under the impression that it is okay to "throw away future identical @import or composes" For example: /* preload_fonts */
@import './font_a.css';
@import './font_b.css';
/* font_a */
:global(.globalFontA) {
font-size: 20px;
font-weight: 1000;
}
.fontA {
composes: baseFont from './font_base.css';
color: blue;
}
/* font_b */
:global(.globalFontB) {
font-size: 20px;
}
.fontB {
composes: baseFont from './font_base.css';
color: green;
}
/* font_base */
.baseFont {
color: red;
font-weight: 600;
font-size: 22;
} should result in: /* preload_fonts */
/* imported font_a */
/* -> start composed font_base */
.baseFont-HASH {
color: red;
font-weight: 600;
font-size: 22;
}
/* -> end composed font_base */
.globalFontA {
font-size: 20px;
font-weight: 1000;
}
.fontA-HASH {
color: blue;
}
/* imported font_b */
/* -> start composed font_base */
/* duplicate, it is now empty somehow */
/* -> end composed font_base */
.globalFontB {
font-size: 20px;
}
.fontB-HASH {
color: green;
} |
it's cause import over hundred times css library in my case😰,in JS it solved with namespace and the library is singled declared well place, in commonjs it's isolated,so it can't override by other module,but in esmoule definition this behavior is allowed. eg: a.js const A = {
a:123
}
export default A
setTimeout(()=>{
console.log(A.a);
}) b.js import A from './a'
A.a = 456 c.js import A from './a'
import './b'
console.log(A.a) >>> 456
>>> 456 // from a.js re-declare class still contain vitiums : lib.css .color{
color:red;
}
.title{
font-size:20px;
} lib2.css .color{
color:blue;
} output.css // from user context
.title{
font-size:16px;
}
// import from lib.css
.color{
color:red;
}
.title{
font-size:20px;
}
// import from lib2.css
.color{
color:blue;
}
// after a title always 20px i think css import's behavior should like ESmodule , just find a solution about css naming or css scope to avoid override |
Expected Behavior
"preload_fonts" which imports "font_a" which composes "font_base" and;
"preload_fonts" which imports "font_b" which composes "font_base".
On this case, the "baseFont" appears only once.
Actual Behavior
the "baseFont" module appears twice.
How Do We Reproduce?
https://github.com/fa93hws/duplicate-import
npm run start
, open console and switch tostyle Editor
tab.The text was updated successfully, but these errors were encountered: