Skip to content

feat: configuring Pug compiler from vue-jest configuration #81

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 10, 2018

Conversation

sandst1
Copy link
Contributor

@sandst1 sandst1 commented Apr 10, 2018

Hi!

We have a set of reusable Vue components that share a lot of functionality and also some features within the template. Since Vue doesn't seem to have a clear way of extending templates, I'm using Pug to define a base template and include it into the child templates (a similar way to how it's done in this article).

All works well and nicely with our Webpack build, but those changes broke our tests. I traced the problem into vue-jest and the fact that there is no way to give the Pug compiler any configuration options. When one is using e.g. absolute paths, Pug requires a 'basedir' attribute to be given, otherwise it will complain and refuse to compile anything.

So, here's a PR that implements support for configuring the Pug compiler via Jest globals! :) The configuration is passed via 'vue-jest': { pug: { basedir: 'mybasedir' } }. Also updated the tests and readme.

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.

Nice work :)

@eddyerburgh eddyerburgh merged commit 0981e65 into vuejs:master Apr 10, 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