Do I need to compile Vue in order to see the style changes I’ve made?

Asked

Viewed 312 times

0

I’m using VUE JS for the first time.

I downloaded all the dependencies through npm, including VUE itself.

I have the following doubts:

  • In order to view the changes in css I need to build?
  • How to import a css library through Vue?
  • I am. There is some difference from it to the VUE JS?

1 answer

1


1 - No, no need to build, build is for when your application is ready and you want the files to send to production, can read more about here. For you to run the project and view your changes give the following command at the prompt: npm run dev, after this command and if the files contain no errors, your application will be able to be viewed by typing in any browser of your preference the following address localhost:8080, to learn more read here.

2 - For you to install any library, framework or any other kind of dependency on the project you can install via command at the prompt, for example install the bootstrap, execute the following command: npm install bootstrap and usually import it into the file index.js in the briefcase router to be available throughout the application with the following command: import Bootstrap from 'bootstrap' and import 'bootstrap/dist/bootstrap.min.css' to be able to use the Bootstrap CSS plus the command: Vue.use(Bootstrap), getting something like this:

import Bootstrap from 'bootstrap'
import 'bootstrap/dist/bootstrap.min.css'

Vue.use(Bootstrap)
  • Thank you very much, I understand perfectly.

  • However, I did refer to a style, actually. If I want to import a style sheet of my own, how should I do it? When I declare the style in <head>, it does not work.

  • No, you don’t have to import, you write the css in the same file. As you are using Vue-cli the files stay with the extension .see, this file is divided into three parts, template which is the HTML, script which is the JS and the style which is CSS, you can write your styles inside these tags.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.