From ea37a2b67c6391822bc31747e5cd702887b3895f Mon Sep 17 00:00:00 2001 From: nikersify Date: Wed, 3 Oct 2018 12:56:51 +0200 Subject: [PATCH] add filename option to pug compiler --- lib/compilers/pug.js | 10 ++++++++-- test/fixtures/pug-included.pug | 1 + test/fixtures/pug.vue | 1 + test/test.js | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/pug-included.pug diff --git a/lib/compilers/pug.js b/lib/compilers/pug.js index 5740b0c..e8f5444 100644 --- a/lib/compilers/pug.js +++ b/lib/compilers/pug.js @@ -1,10 +1,16 @@ var ensureRequire = require('../ensure-require.js') -module.exports = function (raw, cb, compiler) { +module.exports = function (raw, cb, compiler, filePath) { ensureRequire('pug', 'pug') var pug = require('pug') try { - var html = pug.compile(raw, compiler.options.pug || {})() + var defaultOptions = { + filename: filePath + } + var html = pug.compile( + raw, + Object.assign({}, compiler.options.pug || {}, defaultOptions) + )() } catch (err) { return cb(err) } diff --git a/test/fixtures/pug-included.pug b/test/fixtures/pug-included.pug new file mode 100644 index 0000000..4f801d3 --- /dev/null +++ b/test/fixtures/pug-included.pug @@ -0,0 +1 @@ +div Included content diff --git a/test/fixtures/pug.vue b/test/fixtures/pug.vue index 5a43989..a2ba889 100644 --- a/test/fixtures/pug.vue +++ b/test/fixtures/pug.vue @@ -1,6 +1,7 @@ diff --git a/test/test.js b/test/test.js index dfcf92a..b95fa2c 100644 --- a/test/test.js +++ b/test/test.js @@ -87,6 +87,7 @@ describe('vueify', () => { assertRenderFn(module, '
' + '

This is the app

' + + '
Included content
' + '' + '' + '
' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy