Open weshouman opened 1 year ago
Unfortunately, Marp (Marpit framework) has limited support about using @import
for external CSS.
By the spec of CSS, @import
rule(s) for importing external styles always must be at the top of the CSS document. So @import url(...)
in Marp document will work, as like as that statements are always at the top of whole in the slide document. So <style scoped>
is not working because @import
will always be loaded first than theme styles and other inline styles.
In addition, @import
will bypass scoping the output CSS itself when building Marp slide. CSS scoping is important for making a boundary of Marp app styles and slide styles. If bypassed, the outside of slides by Marp apps may not be rendered correctly, or may see inconsistent slide results by apps (as you have seen).
For better result, you should make inlining external CSS.
Version of Marp Tool
marp-vscode
Operating System
Linux
Environment
How to reproduce
Using a scoped import in a section, for example:
Where the content of
custom-theme-scoped.css
is for exampleExpected behavior
The current section only gets the
h2
headers colored in orange.Actual behavior
VSCode: All sections gets
h2
headers gets colored in OrangeMarp CLI: No section gets the `h2 headers colored in Orange
Additional information
Reference: This question on StackOverflow addresses this issue