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

Add a shorthand syntax to define element classes #28

Merged
merged 3 commits into from
Feb 8, 2016

Conversation

Nemo157
Copy link
Contributor

@Nemo157 Nemo157 commented Feb 1, 2016

This is similar to how slim works, very useful when you're using a class heavy css framework. An example from the bootstrap docs

div class="input-group" {
  span class="input-group-addon" { "$" }
  input type="text" class="form-control" aria-label="Amount (to the nearest dollar)" { }
  span class="input-group-addon" { ".00" } 
}

becomes

.input-group {
  span.input-group-addon { "$" }
  input.form-control type="text" aria-label="Amount (to the nearest dollar)" { }
  span.input-group-addon { ".00" } 
}

@lambda-fairy
Copy link
Owner

Thanks for the work you've done so far! I'll do a proper look-through within the next week or so.

@Nemo157
Copy link
Contributor Author

Nemo157 commented Feb 1, 2016

Thanks for starting the project 😄. If you agree with all these changes (or some subset) and want me to merge them together into a single pull request just let me know (there are trivial merge conflicts around the tests 😦).

@lambda-fairy
Copy link
Owner

No worries -- separate pull requests are easier to review, and the merge conflicts are easy to deal with anyway :)

As for the patch: I'm concerned about the ambiguity introduced by the shorthand div syntax. Since you can nest elements using just a space, it would be unclear whether p .foo means a <p> containing a <div> or a <p> with class foo. Similarly for splices: $foo .bar can be read two different ways.

The syntax which includes an explicit tag name looks good though. Can you modify your patch so that it only includes this variant?

@Nemo157
Copy link
Contributor Author

Nemo157 commented Feb 7, 2016

Sure.

@lambda-fairy
Copy link
Owner

Lgtm, thanks!

lambda-fairy added a commit that referenced this pull request Feb 8, 2016
Add a shorthand syntax to define element classes
@lambda-fairy lambda-fairy merged commit 6b14129 into lambda-fairy:master Feb 8, 2016
@Nemo157 Nemo157 deleted the class-shorthand branch February 8, 2016 13:13
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

Successfully merging this pull request may close these issues.

2 participants