Skip to content

Commit 3c28456

Browse files
author
Guillaume Chau
committed
Pug support
1 parent e4fbd6a commit 3c28456

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

packages/vue-pug/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.npm

packages/vue-pug/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Integrate pug with vue single-file components for Meteor
2+
3+
Compatibility: **Vue 1.x, Vue 2.x**
4+
5+
This meteor package adds [pug](http://pugjs.org) support in your single-file `.vue` components.
6+
7+
## Installation
8+
9+
meteor add akryum:vue-pug
10+
11+
12+
## Usage
13+
14+
```html
15+
<template lang="pug">
16+
.post
17+
.message {{data.message}}
18+
a.action(@click="removePost") x
19+
</template>
20+
```
21+
22+
---
23+
24+
LICENCE ISC - Created by Guillaume CHAU (@Akryum)

packages/vue-pug/package.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Package.describe({
2+
name: 'akryum:vue-pug',
3+
version: '0.0.1',
4+
summary: 'Add pug support for vue components',
5+
git: 'https://github.com/Akryum/meteor-vue-component',
6+
documentation: 'README.md'
7+
});
8+
9+
Package.registerBuildPlugin({
10+
name: "vue-component-pug",
11+
use: [
12+
'ecmascript@0.4.3'
13+
],
14+
sources: [
15+
'vue-pug.js'
16+
],
17+
npmDependencies: {
18+
'pug': '2.0.0-beta11'
19+
}
20+
});
21+
22+
Package.onUse(function(api) {
23+
api.use('isobuild:compiler-plugin@1.0.0');
24+
});

packages/vue-pug/vue-pug.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
global.vue = global.vue || {}
2+
global.vue.lang = global.vue.lang || {}
3+
4+
import pug from 'pug';
5+
import { Meteor } from 'meteor/meteor';
6+
7+
global.vue.lang.pug = Meteor.wrapAsync(function({ source, inputFile }, cb) {
8+
var fn = pug.compile(source, {
9+
filename: inputFile.getPathInPackage(),
10+
fileMode: true
11+
});
12+
13+
var html = fn();
14+
15+
cb(null, {
16+
template: html
17+
});
18+
});

0 commit comments

Comments
 (0)