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

how to use options.self=true in pugjs? #142

Open
anlexN opened this issue Nov 24, 2017 · 5 comments
Open

how to use options.self=true in pugjs? #142

anlexN opened this issue Nov 24, 2017 · 5 comments

Comments

@anlexN
Copy link

anlexN commented Nov 24, 2017

No description provided.

@Tiliavir
Copy link

Any details? How to reproduce your issue? How is this related to pug-lint?

@anlexN
Copy link
Author

anlexN commented Nov 27, 2017

@Tiliavir , just options.self = true, how to use. no other problem. can you showcase this? pug document don't details about it!

@Tiliavir
Copy link

This is pug-lint not pugjs - I can't find a single reference for "self" in the pug-lint repository. Where did you find that option? What did you expect it to do?

@anlexN
Copy link
Author

anlexN commented Nov 27, 2017

@Tiliavir
default

@Tiliavir
Copy link

Tiliavir commented Nov 28, 2017

As I said: this issue was created in the wrong repository and should be closed! This is where it should have been created: https://github.com/pugjs/pug

And the documentation is quite clear, no? Set self to true, and variables in the scope are not accessible directly, but as a member of the "self" variable ...

E.g. refering to those "locals" mentioned below your screenshot - a sample could look like this:

options.self = true;
var fn = pug.compileClient('string of pug', options);

var locals = { foo: 1, bar: 2};
var html = fn(locals);

If set to self is set to true, you cant use foo or barby their name directly but usingself.fooand self.bar`...

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