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

Add mount.disableWatch config option #12589

Closed
bep opened this issue Jun 11, 2024 · 2 comments
Closed

Add mount.disableWatch config option #12589

bep opened this issue Jun 11, 2024 · 2 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Jun 11, 2024

https://gohugo.io/hugo-modules/configuration/#module-configuration-mounts

This idea came when working on #8086.

We need to think a little before doing this, but it would probably be really useful and mind-twisting if I could do:

[module]
  [[module.mounts]]
    source = 'public'
    target = 'assets/public'
    disableWatch = true

And then in a template:

{{ with (defer (dict "key" "foo") }}
    {{ $jsonFilePublic := resources.Get "public/mysection/index.json" }}
    ...
{{ end }}

@jmooring do you

  1. See the same potential/usefulness as me?
  2. See any (serious) pitfalls?

I have quickly tested it, and the only issue I have seen is that the mount setup checks to see of source exist before it mounts it, but that's fixable.

@bep bep added the Proposal label Jun 11, 2024
@bep bep self-assigned this Jun 11, 2024
@bep bep added this to the v0.128.0 milestone Jun 11, 2024
@jmooring
Copy link
Member

Although I haven't given it a lot of thought, I haven't come up with any exciting use cases for defer blocks either with or without mounting the public directory to something.

I know that #8077 was one of the motivators for defer blocks, but that was before we introduced Page.Store and documented output format weighting. The backlinks approach described here might be easier to understand if it were rewritten using a defer block per your example above... you could write the data to file instead of stuffing it into a home page Store.

To your original questions...

See the same potential/usefulness as me?

Not yet.

See any (serious) pitfalls?

No.

@bep
Copy link
Member Author

bep commented Jun 11, 2024

I know that #8077 was one of the motivators for defer blocks

I think I would rather call it "an example use" for defer blocks. Back links isn't something I'm terribly exited about, but to be effective at scale, it needs some "first class" support in Hugo.

As to defer, a cleaner way of doing what resources.PostProcess does today is plenty worth it. And then comes JS splitting.

As to this particular issue, I'm having trouble finding useful examples, so I'll let it linger.

@bep bep changed the title Add mount.watch (default true) config option Add mount.disableWatch config option Jun 12, 2024
@bep bep changed the title Add mount.disableWatch config option Add mount.disableWatching config option Jun 12, 2024
@bep bep added Enhancement and removed Proposal labels Jun 12, 2024
@bep bep changed the title Add mount.disableWatching config option Add mount.disableWatch config option Jun 12, 2024
bep added a commit to bep/hugo that referenced this issue Jun 20, 2024
bep added a commit to bep/hugo that referenced this issue Jun 21, 2024
bep added a commit to bep/hugo that referenced this issue Jun 21, 2024
bep added a commit to bep/hugo that referenced this issue Jun 21, 2024
bep added a commit to bep/hugo that referenced this issue Jun 21, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
bep added a commit to bep/hugo that referenced this issue Jun 22, 2024
@bep bep closed this as completed in 6cd0784 Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants