[Vuejs]-How to use CSS in vue.js apps?

2๐Ÿ‘

โœ…

If you concern is about code separation you can have custom CSS code in a component and add a scoped attribute so the styles you are writing there would only apply to that component:

<style lang="scss" scoped>

    /* your scoped css rules here will only apply to this component */

</style>

Now if you also want to compile the CSS from all of your components and merge them into a single final CSS file that you would link from your main HTML file then you need to add a bundler/compiler such as webpack

You can also take a look at vue css-loader to understand how to modularize and compose your CSS rules.

๐Ÿ‘คJose Garrido

Leave a comment