
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
babel-plugin-transform-vue-template
Advanced tools
Compile Vue template at build time via babel plugin.
yarn add babel-plugin-transform-vue-template --dev
yarn add vue-template-compiler --dev
# vue-template-compiler is required as peer dependency
With .babelrc
:
{
"plugins": ["transform-vue-template"]
}
Then every object property template
whose value is a template string literal will be compiled to render
function at build time:
export default {
template: `<div>
<button @click="whatever">Click me!</button>
</div>`,
methods: {
whatever() {
// do whatever
}
}
}
Compiled code:
export default {
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', [_c('button', {
on: {
"click": _vm.whatever
}
}, [_vm._v("Click me!")])]);
},
staticRenderFns: [],
methods: {
whatever() {// do whatever
}
}
};
This plugin also handles tagged template expression, it simply ignores the tag:
export default {
template: html`<div>{{ message }}</div>`
}
Note that the tag name can only be html
.
Add a comment block with @transform-disable
to the previous line:
export default {
// @transform-disable
template: `<div></div>`
}
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
babel-plugin-transform-vue-template © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoist.moe · GitHub @egoist · Twitter @_egoistlily
FAQs
as you can tell from the name.
The npm package babel-plugin-transform-vue-template receives a total of 184 weekly downloads. As such, babel-plugin-transform-vue-template popularity was classified as not popular.
We found that babel-plugin-transform-vue-template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.