Skip to content

Comments

Auto rebuild css in pxt serve#9254

Merged
jwunderl merged 7 commits intomasterfrom
autoRebuildCss
Dec 1, 2022
Merged

Auto rebuild css in pxt serve#9254
jwunderl merged 7 commits intomasterfrom
autoRebuildCss

Conversation

@jwunderl
Copy link
Member

@jwunderl jwunderl commented Dec 1, 2022

in pxt serve also watch for css changes and rebuild when they occur. little noisey in the serve window if you start making changes, but that's already super noisy if you're e.g. making common packages changers so doesn't feel like a big deal.

Copy link
Member

@riknoll riknoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally!


await buildAndWatchAsync(buildTarget, 1)
await buildAndWatchAsync(buildCss, 6);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you determine the max depth needed?

Copy link
Member Author

@jwunderl jwunderl Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first one I left at 1 mainly to avoid having to dig into the existing watch logic too much - if you look at where dirsToWatch gets added to, there are lots of places where we aggregate, and it looks like at least a few had subdirectories with generated files (e.g. libs/ folder for game library code can have locale data get saved as part of pxt serve, so if we rebuilt based off that there could be constant reloads) - I'll add a comment here

The secone one for the css watch was check me taking the deepest path we currently have (which ends up being something like a nested theme folder with a site.variables file in a few of its subdirs) and adding a few for padding / safety sake - this tends to be how all the maxDepths in here that aren't 1 tend to end up being set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's possible if someone had a deeply nested css/less file that it wouldn't pick up the changes. I guess that's just something to keep in mind.

Copy link
Member Author

@jwunderl jwunderl Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right -- as far as I've seen, the files that are actually currently used typically max out at around folder + 2 (e.g. [react-common/styles]/control/blah.less, [theme]/site/elements/blah.variables, so there's plenty of wiggle room. This issue is present for most of our watchers though, good to be aware of as you mentioned~

@jwunderl jwunderl merged commit 06f2e7e into master Dec 1, 2022
@jwunderl jwunderl deleted the autoRebuildCss branch December 1, 2022 21:17
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.

4 participants