@vituum/vite-plugin-pug 1.0.0-alpha.1 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -31
- package/index.js +2 -1
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -7,46 +7,29 @@
|
|
|
7
7
|
import pug from '@vituum/vite-plugin-pug'
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
filetypes: {
|
|
20
|
-
html: /.(json.html|pug.json.html|pug.html)$/,
|
|
21
|
-
json: /.(json.pug.html)$/
|
|
22
|
-
},
|
|
23
|
-
pug: {}
|
|
24
|
-
})
|
|
25
|
-
]
|
|
10
|
+
plugins: [
|
|
11
|
+
pug()
|
|
12
|
+
],
|
|
13
|
+
build: {
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
input: ['index.pug.html']
|
|
16
|
+
}
|
|
17
|
+
}
|
|
26
18
|
}
|
|
27
19
|
```
|
|
28
20
|
|
|
29
|
-
Read the [docs](https://vituum.dev/
|
|
21
|
+
* Read the [docs](https://vituum.dev/plugins/pug.html) to learn more about the plugin options.
|
|
22
|
+
* Use with [Vituum](https://vituum.dev) to get full functionality.
|
|
30
23
|
|
|
31
24
|
## Basic usage
|
|
32
25
|
|
|
33
26
|
```html
|
|
34
|
-
<!-- index.
|
|
35
|
-
<script type="application/json" data-format="pug">
|
|
36
|
-
{
|
|
37
|
-
"template": "path/to/template.pug",
|
|
38
|
-
"title": "Hello world"
|
|
39
|
-
}
|
|
40
|
-
</script>
|
|
41
|
-
```
|
|
42
|
-
or
|
|
43
|
-
```html
|
|
44
|
-
<!-- index.pug.html -->
|
|
27
|
+
<!-- index.pug -->
|
|
45
28
|
include /path/to/template.pug
|
|
46
29
|
```
|
|
47
30
|
or
|
|
48
31
|
```html
|
|
49
|
-
<!-- index.json
|
|
32
|
+
<!-- index.json -->
|
|
50
33
|
{
|
|
51
34
|
"template": "path/to/template.pug",
|
|
52
35
|
"title": "Hello world"
|
|
@@ -55,5 +38,5 @@ or
|
|
|
55
38
|
|
|
56
39
|
### Requirements
|
|
57
40
|
|
|
58
|
-
- [Node.js LTS (
|
|
59
|
-
- [Vite](https://vitejs.dev/)
|
|
41
|
+
- [Node.js LTS (18.x)](https://nodejs.org/en/download/)
|
|
42
|
+
- [Vite](https://vitejs.dev/)
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ const defaultOptions = {
|
|
|
21
21
|
},
|
|
22
22
|
data: ['src/data/**/*.json'],
|
|
23
23
|
formats: ['pug', 'json.pug', 'json'],
|
|
24
|
+
ignoredPaths: [],
|
|
24
25
|
options: {}
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -55,7 +56,7 @@ const renderTemplate = async ({ filename, server, root }, content, options) => {
|
|
|
55
56
|
|
|
56
57
|
return new Promise((resolve) => {
|
|
57
58
|
try {
|
|
58
|
-
const template = pug.compileFile(output.template ? context.template : filename, Object.assign(options.options, {
|
|
59
|
+
const template = pug.compileFile(output.template ? context.template : server ? initialFilename : filename, Object.assign(options.options, {
|
|
59
60
|
basedir: options.root,
|
|
60
61
|
filters: options.filters
|
|
61
62
|
}))
|
package/package.json
CHANGED