Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

class syntax #173

Open
useruser1 opened this issue Sep 30, 2015 · 2 comments
Open

class syntax #173

useruser1 opened this issue Sep 30, 2015 · 2 comments
Labels

Comments

@useruser1
Copy link

better syntax is
class="checked? private?"
instead of
class="{{#if checked}}checked{{/if}} {{#if private}}private{{/if}}"

@dalgard
Copy link

dalgard commented Oct 14, 2015

Is this an official part of Jade or a proposal for new syntax?

@AlbinoGeek
Copy link
Contributor

I think he was proposing a Coffeescript-alike format in which "foo?" returns true if foo is defined, and false if foo is not defined. Here is an example in CoffeeScript, that compiles down to JavaScript:

console.log(foo) if foo?

Compiles to:

if (typeof foo !== "undefined" && foo !== null) {
  console.log(foo);
}

However, what he was asking for would require more than just this, as we're not taking "foo" as a variable name, but instead using foo as the literal output (?)

I still think #1 fixed would be better:

.item(class={selected:selected?}) Selected Item
.item(class={selected:true}) Selected Item
.item(class={selected:false}) Not Selected Item

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants