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

Trigger live reload when a template is updated #8

Closed
jono-hayward opened this issue Aug 31, 2018 · 3 comments · Fixed by #11
Closed

Trigger live reload when a template is updated #8

jono-hayward opened this issue Aug 31, 2018 · 3 comments · Fixed by #11

Comments

@jono-hayward
Copy link

My project uses template inheritance and a lot of included sub templates to manage the markup, with an entry point file (index.njk) that looks like this:

{% extends './templates/partials/_wrapper.njk' %}

{% block content %}

  {% include './templates/masthead.njk' %}

  {% include './templates/news.njk' %}

  {% include './templates/intro.njk' %}

  [...]

{% endblock %}

All of this structure works fine, except my live Parcel development server only refreshes the markup when index.njk is updated, not any of the templates it imports.

Is there any way to get Parcel to recognise when a sub template has been updated and refresh the markup?

@devmattrick
Copy link
Collaborator

The only way I can come up with for this to work is to have Parcel handle the dependency resolution instead of Nunjucks, but this would require that this project parse Nunjucks templates manually. I've seen a few projects that claim to parse Nunjucks into an AST but I'd prefer to use the actual nunjucks package so its largely compatible with any updates that may happen.

I'll have to look into it a bit more, I'm not sure if Nunjucks exposes any of these APIs.

@gterras
Copy link

gterras commented Sep 21, 2019

Hi,

Any news on this issue ?

@chocolateboy
Copy link
Owner

WFM. If you think you've found a bug, please raise a new issue with a reproducible test case.

Note that due to a bug in Parcel, HMR doesn't currently work (the HMR code isn't sent to the client) unless the page includes JavaScript.

Repository owner locked as resolved and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants