-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Feature Request: Make the separation of attributes with a comma an option #13
Comments
The documentation says the following:
So there are two different possibilities: // Using commas
div(class='div-class', (click)='play()')
// Using quoted attributes
div(class='div-class' '(click)'='play()') However, there is a problem: I'm currently not sure, if we can only have a Do you think we should let the developer decide to use something like |
These are all great points @Shinigami92 I had never used pug with Angular, Vue or any framework with templates. I've been using it for years to create static website templates and those are great use cases. I really like your suggestion, I feel like I am questioning myself now, haha |
What do you think of this. Having an option, called |
So {
"attributeSeparator": true,
"attributeSeparator": "comma",
"attributeSeparator": false,
"attributeSeparator": "none",
"attributeSeparator": "quotes"
} And what if someone thinks "Hey, I'm happy and want colons" 😄?
🤔 I think we should find an option that does not need to be documented, strictly clear and simple. |
@Shinigami92 took a look at those and you are right again. We start giving too many options, things will get out of control. I like your original idea, just |
@marlonmarcello Currently working on this feature. hello-framework([name]="name" [version]="version", (release)="onVersionRelease()")
// converts to
<hello-framework [name]="version" (release)="onVersionRelease()"></hello-framework> Note the merged hello-framework([name]="name", [version]="version", (release)="onVersionRelease()")
// converts to
<hello-framework [name]="name", [version]="version", (release)="onVersionRelease()"></hello-framework> |
Please give me some examples, so I can add it to the tests |
Oh man. To be fair, on the first example it's a mix of commas and not commas, I feel like that is a job for a linter to fix? What do you think? Some examples: Multi line attributes:
Mixin plus attributes:
Variable attributes:
|
Um... Should Can you give me also the |
I don't think it should be, the PUG compiler will deal with that, because for example, if you set your doctype to This is the anchor mixin
|
... Have to handle |
Yeah, it's a special case. |
OK ... it works ... ^^ ' If you want, you can clone the repo, use Edit: and you need to perform |
Amazing work @Shinigami92 ! Thanks a lot |
Hi @Shinigami92 !
As we previously talked on #11 I am making a feature request!
Looking through Pug's docs, they never use comma to separate the attributes on tags.
I think we should keep it consistent and have that same behaviour as default.
I, personally would remove the comma separation completely but I can see how it can be nice for other users, so I propose we make it an option.
The option could be called
useCommaAttributes
, or something similar, it would be aboolean
that if set totrue
would have the parser add commas to separate the attributes on tags.Thanks again, and please let me know your thoughts.
The text was updated successfully, but these errors were encountered: