-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
After looking through the livestyle code I feel there are a bunch of things that are not needed.
.compilessincludesis imo an anti pattern. livestyle-client implements something very specific to an external middleware- The whole polling for style sheet updates is very expensive and run all the time.
- Support for less.js and prefixfree seem like bloat now. Preprocessing should move to the server
Suggestions for changed architecture:
- Stop polling for asset additions on the client and have it register a listener in the server
- Have the server set up the relevant file watches during the serving of each file
- Have the server emit update events to the relevant clients when a file updates
- Only have the client traverse its stylesheets when an update event is received. Maybe the server could store a limited dependency graph based on referer headers, guiding the client to a more direct traversal instead of reading everything. Obviously the client could leverage some caching for assets that are known not to have changed
File waching changes:
- Have the file watcher automatically register watchers on any url that responds and matches the configured pattern
- Have all middlewares that compile multiple files into single files emit events that tell a possible file watcher to also watch the included file, and which bundle the file is included in. When any dependency of a bundle is updated, the bundle url is emitted as updated. For sass and less includes or any other bundling middleware this will work fine.
I'm not entirely sure how this would affect polling for non-socket browsers.
Any feedback?