@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 CHANGED
@@ -7,46 +7,29 @@
7
7
  import pug from '@vituum/vite-plugin-pug'
8
8
 
9
9
  export default {
10
- plugins: [
11
- pug({
12
- reload: true,
13
- root: null,
14
- filters: {},
15
- data: '*.json',
16
- globals: {
17
- template: 'path/to/template.pug'
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/config/integrations-options.html#vituum-pug) to learn more about the plugin options.
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.html -->
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.html or index.pug.json.html -->
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 (16.x)](https://nodejs.org/en/download/)
59
- - [Vite](https://vitejs.dev/) or [Vituum](https://vituum.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vituum/vite-plugin-pug",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/types/index.d.ts CHANGED
@@ -32,6 +32,6 @@ export interface PluginUserConfig {
32
32
  globals?: Object
33
33
  data?: string | string[]
34
34
  formats?: string[]
35
- options?: PugOptions
36
35
  ignoredPaths?: string[]
36
+ options?: PugOptions
37
37
  }