-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Only apply svelte-123xyz attributes where necessary #680
Conversation
This is almost done — think I just need to implement |
Taking the WIP off the title, in case anyone fancies taking a look! |
src/generators/Generator.ts
Outdated
@@ -40,6 +41,8 @@ export default class Generator { | |||
cssId: string; | |||
usesRefs: boolean; | |||
|
|||
selectors: any[]; // TODO how to indicate it takes `(Node[]) => boolean` functions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectors: ((nodes: Node[]) => boolean)[];
I believe
edit: Although this type doesn't seem to match how it's used later. extractSelectors
returns simply Node[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Have refactored it a bit so that it's a bit more TS-friendly (and possibly a bit clearer anyway) — a Selector
class with an apply
method
Did a bit more futzing around after merging #689 and concluded that we could use a more comprehensive refactoring of the CSS code, which is currently a bit scattered and woolly. In particular, it would be nice to support CSS sourcemaps (and maybe in future, CSS from multiple sources i.e. |
Making a start on #679 (and laying the groundwork for #678). Have hit a bit of a snag — the work needs to happen in
preprocess
, because of descendant selectors:That's going to cause some nasty merge conflicts unless I merge #673 and #676, so I'll do that first.