-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
CSS Hotreload if put in html #128
CSS Hotreload if put in html #128
Conversation
…parcel into feature/css-html-hotreload
src/builtins/hmr-runtime.js
Outdated
// CSS should always update | ||
if (asset.generated && asset.generated.css) { | ||
asset.isNew = false; | ||
} |
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.
Not sure I understand why this was added. Can you explain?
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.
First time css gets edited it doesn't have it inside modules so it only updates from second edit up.
This should fix that, there is potentially a better fix for it though but thought this fix wasn't that bad because every generated js for css updates is the same anyway.
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.
Ah interesting. That's an interesting issue. Seems that the HMR code is not actually getting bundled into the JS output. Will look into it a bit more.
src/packagers/HTMLPackager.js
Outdated
|
||
if (!head.content) { | ||
head.content = []; | ||
} |
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.
maybe the above code can be moved to another method/function and shared with the css version?
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.
Probably a good idea, i'll look into that
@DeMoorJasper refactored slightly. Now ensuring that the HMR JS produced by the CSSAsset is actually included in the JS bundle rather than adding a CSS specific hack to the runtime. Also merged the sibling bundle insertion code into a single pass, and added a test. Let me know if it works for you! |
@devongovett works perfectly 👍 |
* css refresh on html * clean and clear up code a lil * remove console log * improve code structure * Ensure that CSS HMR JS is actually included in the bundle * Refactor sibling bundle insertion in HTMLPackager and add test * Use urlJoin
* css refresh on html * clean and clear up code a lil * remove console log * improve code structure * Ensure that CSS HMR JS is actually included in the bundle * Refactor sibling bundle insertion in HTMLPackager and add test * Use urlJoin
Potential fix for closes #57