vue-pug

1.0.2 • Public • Published

#vue-pug Compiles plain pug files into vue.js templates; compatible with webpack


Usage

  • As a webpack loader

webpack.config.js

module.exports = {
    entry: {
        index: {
            import: "src/index.js"
        }
    },
    module: {
        rules: [
            {
                "test": /\.pvue$/,
                "use": [
                    "vue-pug"
                ]
            }
        ]
    }
};

src/template.pvue

h2|Hewwo Wowd! owo
p="You're visiting" + author + "'s page, and currently is " + time + " o'clock :)"

if author != "Matheus Giovani"
    p|Boo, the author is not Matheus Giovani! :(
else
    p|Welcome to the original plugin author page!

each item in items
    p=item.text

src/index.js

const app = new Vue({
    el: "#app",
    template: require("./template.pvue"),
    data: {
        author: "Matheus Giovani",
        time: (new Date()).toLocaleTimeString(),
        items: [
            {
                text: "Test item"
            },
            {
                text: "Second test item"
            }
        ]
    }
});

Readme

Keywords

none

Package Sidebar

Install

npm i vue-pug

Weekly Downloads

19

Version

1.0.2

License

GPL-2.0

Unpacked Size

28.9 kB

Total Files

5

Last publish

Collaborators

  • prometeus