- 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