@vituum/vite-plugin-pug 0.1.2 → 0.1.3

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 +5 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -40,13 +40,17 @@ const renderTemplate = async(filename, content, options) => {
40
40
  const context = options.data ? processData(options.data, options.globals) : options.globals
41
41
 
42
42
  const isJson = filename.endsWith('.json.html') || filename.endsWith('.json')
43
- const isHtml = filename.endsWith('.html') && !filename.endsWith('.json.html')
43
+ const isHtml = filename.endsWith('.html') && !options.filetypes.html.test(filename) && !options.filetypes.json.test(filename) && !isJson
44
44
 
45
45
  if (isJson || isHtml) {
46
46
  lodash.merge(context, isHtml ? content : JSON.parse(fs.readFileSync(filename).toString()))
47
47
 
48
48
  output.template = true
49
49
 
50
+ if (typeof context.template === 'undefined') {
51
+ console.error(chalk.red(name + ' template must be defined - ' + filename))
52
+ }
53
+
50
54
  context.template = relative(process.cwd(), context.template).startsWith(relative(process.cwd(), options.root))
51
55
  ? resolve(process.cwd(), context.template) : resolve(options.root, context.template)
52
56
  } else if (fs.existsSync(filename + '.json')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vituum/vite-plugin-pug",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "dependencies": {