vue2-html-loader

1.0.5 • Public • Published
Vue logo

Vue2 HTML Loader

Exports HTML as string. HTML is minimized when the compiler demands.

This loader is similar to html-loader ,but the difference is this loader treat the html template as a string, It does not replace custom tags and attributes, and there is no intention to leave a space between the tags when removing spaces. it may cause an error in the vue $sloat processing.

Install

npm i -D vue2-html-loader

Usage

{
  test: /\.(html)$/,
  use: {
    loader: 'vue2-html-loader',
    options: {
      removeComments: true,
      removeWhiteSpace: true,
      removeNewline: true,
    }
  }
}
import template from 'path/to/your/template.html';

new Vue({
  template,
  ...otherOptions
});

Use Typescript

import template from 'path/to/your/template.html';

@Component({
  template,
})
export default class VueComponents extends Vue {
  ...others
}

Options Quick Reference

Most of the options are disabled by default.

Option Description Default
removeComments remove html comments true
removeWhiteSpace remove html whiteSpace true
removeNewline remove html newLine (actual \r\n) true

Package Sidebar

Install

npm i vue2-html-loader

Weekly Downloads

31

Version

1.0.5

License

ISC

Unpacked Size

4.36 kB

Total Files

4

Last publish

Collaborators

  • namehu