Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/altipla-consulting/vue-template-compiler-loader
Webpack loader to pre-compile Vue 2.0 templates. - Allows custom compiler options.
https://github.com/altipla-consulting/vue-template-compiler-loader
vuejs webpack webpack-loader
Last synced: about 1 month ago
JSON representation
Webpack loader to pre-compile Vue 2.0 templates. - Allows custom compiler options.
- Host: GitHub
- URL: https://github.com/altipla-consulting/vue-template-compiler-loader
- Owner: altipla-consulting
- License: mit
- Created: 2020-05-01T17:28:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T17:29:10.000Z (almost 2 years ago)
- Last Synced: 2024-11-16T14:36:12.864Z (about 2 months ago)
- Topics: vuejs, webpack, webpack-loader
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-template-compiler-loader
This is a copy of the official `vue-template-compiler-loader` that allows custom compiler options.
See this repo for the original source code: https://github.com/fergaldoyle/vue-template-compiler-loader
## Install
```shell
npm i @altipla/vue-template-compiler-loader --save-dev
```You will also need the peer dependency of `vue-template-compiler` in the same version as Vue. All the compiler versions work with the latest release of this package.
```shell
npm i vue-template-compiler --save-dev
```## Configuration
Add this configuration to your `module.loaders` inside `webpack.config.js`:
```js
{
test: /\.vhtml$/,
loader: '@altipla/vue-template-compiler',
options: {
compilerOptions: {
whitespace: 'preserve',
},
},
},
```You can use any option of the compiler available in [the documentation](https://www.npmjs.com/package/vue-template-compiler).
## Usage
Split the template and the script in two files and you can import it from the component:
```js
import Vue from 'vue';import template from './my-component.vhtml';
Vue.component('my-component', {
...template,mounted () {
// ...
},
});
```