I'm trying to include a cdn external css file in my vue-cli-3 project, so I added the css file in the public/index.html
file like this:
<link rel="stylesheet" href="http://mycssfile.css">
But the css is not included in the generated index.html
file. this used to work in vuejs2, I don't understand why it doesn't work with vuejs3. Any idea what the problem is? thanks
Importing CSS in Vue components If you are setup and using webpack, you should be able to import css directly from inside <style> tags in component files. More info here: https://cli.vuejs.org/guide/css.html.
You can add cdn styles/scripts directly to the ./index. html or ./public/index. html in [email protected].
In Vue. js, we can add an inline style to our element by binding the style attribute in the HTML tag. For reference, :style is shorthand for v-bind:style . Inline styling can be done in two ways: using object syntax or array syntax.
It is simple. On your main.vue add the following
<style>
@import "https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css";
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With