Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
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 111 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.