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

[Feature Request] SCSS-style nesting #196

Open
garrettw opened this issue May 14, 2018 · 5 comments
Open

[Feature Request] SCSS-style nesting #196

garrettw opened this issue May 14, 2018 · 5 comments

Comments

@garrettw
Copy link
Contributor

garrettw commented May 14, 2018

Would it be possible to add at least some features from Sass' SCSS syntax, such as nested selectors? This could be useful for data looping (see #195).
Of course, this should not replace the current way of accomplishing the same thing, but rather add to it.

For reference, what I am asking for is this kind of thing:

.list {
  repeat: data();

  .item { // equivalent to: .list .item
    content: iteration();
  }

  .parent &::attr(id) { // equivalent to: .parent .list::attr(id)
    content: "special";
  }

  &.alternate { // equivalent to: .list.alternate
    content: "something else";
  }
}
@TRPB
Copy link
Member

TRPB commented May 15, 2018

It would be possible but might need some fairly fundamental changes to the parser. Certainly nested syntax would be possible & would take a bit more work I think.

@garrettw
Copy link
Contributor Author

garrettw commented May 15, 2018

Implementing & would be a necessary part of it IMO because you may not always want nested selectors to behave as if they are separated by a space.

Here's an idea: what if you were to replace your TSS parser with a modified version of leafo/scssphp? I don't know how much modification would be necessary, but it could be useful.

@TRPB
Copy link
Member

TRPB commented May 15, 2018

It would be a significant amount of work. As it would create a different data structure, anything which reads the TSS will need to be rewritten. It would be less work (and easier) to amend the parser. I'll put this on the to-do list but there's a few other things I want to do first.

@garrettw garrettw reopened this May 15, 2018
@garrettw
Copy link
Contributor Author

For the record, the CSSWG has started working on a nesting spec. Once it makes it past the Working Draft stage, that might be what Transphporm should implement.
Follow the PR here: w3c/csswg-drafts#2878

@garrettw garrettw changed the title SCSS-style syntax? [Feature Request] SCSS-style nesting Jul 12, 2018
@SolidSnakeGr
Copy link

What if we could have a watcher that compiles nested tss to basic tss, just like it happens with scss to css..?

This way the transphporm core wouldn't have to be changed and it won't affect any existing tss templates that we currently have.

It would be optional for anyone who needs it, and could be developed as a side project to transphporm.

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

3 participants