Skip to content

feat: Support for extending pug templates using relative paths #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

sandst1
Copy link
Contributor

@sandst1 sandst1 commented Apr 11, 2018

Here's another. When extending a Pug template from a relative path, Pug compiler requires a filename attribute to be given in the compile() method options.

<template lang="pug">
  extends ../relative/PugRelativeBase.pug
  block component
    div(class="pug-extended")
</template>

...

pug.compile(templateData, { filename: '/home/user/my/coolest/template/ever.pug' })

Apparently the filename has to be the full path to the file being compiled, which is something that can't be achieved via Jest configuration since it's common to all tests. But as the full path of the file being processed is available in the template compiler, it's easy to pass it to the Pug compiler in order to make extending from relative paths work correctly.

Copy link
Member

@eddyerburgh eddyerburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again :)

@eddyerburgh eddyerburgh merged commit f9516a8 into vuejs:master Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants