- Issue created by @balintbrews
- Merge request !942#3520867: Stop-gap solution: Code editor preview doesn't include CSS for dependencies of dependencies β (Merged) created by Unnamed author
- π³π±Netherlands balintbrews Amsterdam, NL
Assigning for review to land the stop-gap solution, then we'll leave the issue open for the proper one.
-
balintbrews β
committed f33b757c on 0.x
Issue #3520867 by balintbrews: Code editor preview doesn't include CSS...
-
balintbrews β
committed f33b757c on 0.x
- First commit to issue fork.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
I tinkered a bit with the ?withDeps option and it doesn't really work because for published components the CSS is written to disk so we can't get a different version based on a url param.
I was thinking what about we add a new controller /xb/api/code-component/css-preview that takes a URL param for the imports we need.
So then in Preview.tsx we'd just hit `xb/api/code-components/css-preview?components[]=code&components[]=hero` where we're basically requesting all of the import names we parsed from the AST.
Then that controller can just include the CSS for each of them, including their deps.
- π³π±Netherlands balintbrews Amsterdam, NL
#7: Would the new controller take care of returning the CSS for the dependencies (and their dependencies, recursively) of the import names we pass? I assume yes, otherwise we'd be back to why I chose the stop-gap solution where we would need to parse all dependencies recursively to be able to pass all component names.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Yes and it would be smart enough to know to load the autosave version if a draft existed
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
I bet my MR at π JavaScriptComponent CSS libraries should depend on AssetLibrary libraries Active will fix this for real. Can you test + confirm, @balintbrews?
- Issue was unassigned.
- Status changed to Needs work
11 days ago 11:33am 23 June 2025 - π³π±Netherlands balintbrews Amsterdam, NL
#10: I don't think that MR fixes this issue. Also, there is nothing broken currently, it's just the way we include CSS in the code editor preview is not optimal, because we include CSS for every code component that exist. I re-titled the issue and updated the summary to reflect what's left here.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
I see β then changing from to π