Skip to content
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

Merged
merged 13 commits into from
Jan 6, 2018
Merged

CSS Hotreload if put in html #128

merged 13 commits into from
Jan 6, 2018

Conversation

DeMoorJasper
Copy link
Member

@DeMoorJasper DeMoorJasper commented Dec 8, 2017

Potential fix for closes #57

// CSS should always update
if (asset.generated && asset.generated.css) {
asset.isNew = false;
}
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.


if (!head.content) {
head.content = [];
}
Copy link
Member

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?

Copy link
Member Author

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

@devongovett
Copy link
Member

@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!

@DeMoorJasper
Copy link
Member Author

@devongovett works perfectly 👍

@devongovett devongovett merged commit fb3f9d7 into parcel-bundler:master Jan 6, 2018
@DeMoorJasper DeMoorJasper deleted the feature/css-html-hotreload branch January 6, 2018 18:44
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* 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
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* 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
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.

Css not auto-updating if required from html
2 participants