Skip to content

Instantly share code, notes, and snippets.

@haryantowang09
Last active August 17, 2023 18:06
Show Gist options
  • Save haryantowang09/f37352ad9fc3940cbdf9a00d5c12c7b4 to your computer and use it in GitHub Desktop.
Save haryantowang09/f37352ad9fc3940cbdf9a00d5c12c7b4 to your computer and use it in GitHub Desktop.
What could happen Vue CSS Scope with @import
/**
* Asnwer:
* @import new-style.css wrapped inside <style scope> won't make the CSS code imported become scoped
**/
# Correct Scoped
<style scoped>
header {
width: 100%;
height: 5rem;
background-color: #3d008d;
display: flex;
justify-content: center;
align-items: center;
}
# Failed Scoping
<style scoped>
@import '../../assets/header.css';
</style>
COMMENTS
Now the interesting part is WHY ?
Let's go to stackoverflow first
Clues
https://stackoverflow.com/questions/63609445/vue-style-scoped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment