@vituum/vite-plugin-pug 0.0.1 → 0.1.0

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.
Files changed (2) hide show
  1. package/index.js +6 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -15,7 +15,8 @@ const defaultOptions = {
15
15
  filetypes: {
16
16
  html: /.(json.html|pug.json.html|pug.html)$/,
17
17
  json: /.(json.pug.html)$/
18
- }
18
+ },
19
+ compileOptions: {}
19
20
  }
20
21
 
21
22
  function processData(paths, data = {}) {
@@ -43,16 +44,17 @@ const renderTemplate = async(filename, content, options) => {
43
44
  ) {
44
45
  lodash.merge(context, JSON.parse(fs.readFileSync(filename).toString()))
45
46
 
47
+ isTemplate = true
48
+
46
49
  context.template = relative(process.cwd(), context.template)
47
50
  } else if (fs.existsSync(filename + '.json')) {
48
51
  lodash.merge(context, JSON.parse(fs.readFileSync(filename + '.json').toString()))
49
52
  }
50
53
 
51
54
  try {
52
- const template = pug.compileFile(isTemplate ? context.template : filename, {
53
- basedir: options.root,
55
+ const template = pug.compileFile(isTemplate ? context.template : filename, Object.assign(options.compileOptions, {
54
56
  filters: options.filters
55
- })
57
+ }))
56
58
 
57
59
  output.content = template(context)
58
60
  } catch(error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vituum/vite-plugin-pug",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "dependencies": {