How to include css files in Vue 2 How to include css files in Vue 2 vue.js vue.js

How to include css files in Vue 2


You can import the css file on App.vue, inside the style tag.

<style>  @import './assets/styles/yourstyles.css';</style>

Also, make sure you have the right loaders installed, if you need any.


Try using the @ symbol before the url string. Import your css in the following manner:

import Vue from 'vue'require('@/assets/styles/main.css')

In your App.vue file you can do this to import a css file in the style tag

<template>  <div>  </div></template><style scoped src="@/assets/styles/mystyles.css"></style>


You can import CSS file on component inside script tag

<template></template><script>import "@/assets/<file-name>.css";export default {}</script><style></style>