cjss-group / CJSS

A CSS based web framework
https://cjss.js.org/
MIT License
670 stars 20 forks source link

Allow for expansion regardless of order #27

Closed c-harding closed 5 years ago

c-harding commented 5 years ago

At the moment, CSS rules are evaluated strictly in the order they appear in the source code. This makes ordering the CSS a challenge. In addition, it prevents any sort of recursion.

I would propose parsing all the CSS rules, then evaluating each of them, marking each element as having completed each rule internally. The rules are iterated, and whenever --body is evaluated, all the rules (up to and including the currently processed rule) are run on its child structure recursively too.

c-harding commented 5 years ago

With #37 this should be an extremely easy refactor.

c-harding commented 5 years ago

@KargJonas should script {} rules be executed first or last?

KargJonas commented 5 years ago

Hmm.. Good question. Maybe we need lifecycle methods or events so the user can decide.