Skip to content
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

Changes to options passed to pugCompile #30

Open
ku3mich opened this issue Sep 14, 2017 · 1 comment
Open

Changes to options passed to pugCompile #30

ku3mich opened this issue Sep 14, 2017 · 1 comment

Comments

@ku3mich
Copy link
Contributor

ku3mich commented Sep 14, 2017

Apart from 'pretty' and 'basedir' settings that now are available through pugzor configuration options it will be good to add these:

  • globals: Array Add a list of global names to make accessible in templates.

Can be useful to store constants, may be some common JS code. Yes, now it possible too using code inside pug and/or ViewState.

  • cache: boolean If set to true, compiled functions are cached. filename must be set as the cache key. Only applies to render functions. Defaults to false.

As you see we do not pass cache so every time pug view is recompiled. Performance leak?

  • self: boolean
    Use a self namespace to hold the locals. It will speed up the compilation, but instead of writing variable you will have to write self.variable to access a property of the locals object. Defaults to false.

Not sure how it works, but also can useful in performance aspect.

What do you think?

@mavanmanen
Copy link
Contributor

I don't have much knowledge of nodejs when it comes to whether it's possible, but if you know it is and know how to implement it I think it'd be great to have.

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

No branches or pull requests

2 participants