mayank3503
mayank3503

Reputation: 367

Connecting html pages to vue page

i created a dashboard using vue.js but i have earlier created simple web pages using basic Html and CSS . Is there any method of redirecting the Html page to vue dashboard on click of a button . Vue dashboard is a different project

Upvotes: 0

Views: 69

Answers (1)

Abdelillah Aissani
Abdelillah Aissani

Reputation: 3108

It is better and easier to just transform the static HTML page into a component by simply creating a component and copy pasting the static HTML code inside the component template however if you insist on importing the file as HTML format you might need to install a package called html-loader with :

yarn add html-loader | npm install html-loader

Then you need to update your webpack.config.js file with :

{
   test: /\.(html)$/,
   exclude: /(node_modules)/,
   use: {
   oader: "html-loader"
   }
}

Then you import the HTML file with :

 import FileName from '/path/to/yourFilePath.html'

And finally you nest the template inside your router config :

 {
  path: '/path',
  name: 'routeName',
  component: { template: FileName}
}

Upvotes: 3

Related Questions