pugjs / pug-lint

An unopinionated and configurable linter and style checker for Pug
ISC License
228 stars 51 forks source link

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

Open anlexN opened 6 years ago

Tiliavir commented 6 years ago

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

anlexN commented 6 years ago

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

Tiliavir commented 6 years ago

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 commented 6 years ago

@Tiliavir default

Tiliavir commented 6 years ago

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.fooandself.bar`...