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

hugo: Configurable ignore list (filename regular expressions) #1189

Closed
ehammond opened this issue Jun 3, 2015 · 5 comments
Closed

hugo: Configurable ignore list (filename regular expressions) #1189

ehammond opened this issue Jun 3, 2015 · 5 comments

Comments

@ehammond
Copy link

ehammond commented Jun 3, 2015

Per http://discuss.gohugo.io/t/hugo-server-watch-should-ignore-emacs-lock-files/1265

Please add the ability to configure a list of regular expressions that specify filename patterns that hugo server --watch should ignore as triggers for rebuilding the site.

For example, I would like to add ^\.# (Emacs lock file symlink prefix) to the list to prevent hugo rebuild and browser reload every time I start editing a file.

@bep bep added the Enhancement label Jun 3, 2015
@bep bep closed this as completed in bed2278 Jun 3, 2015
bep added a commit that referenced this issue Jun 3, 2015
Because this isn't just about server and watching.

See #1189
bep added a commit that referenced this issue Jun 3, 2015
@ehammond
Copy link
Author

ehammond commented Jun 3, 2015

Your speed scares me. But thank you.

@bep
Copy link
Member

bep commented Jun 3, 2015

Note my latest commit - I renamed it to ignoreFiles.

bep added a commit that referenced this issue Jun 3, 2015
And log error on invalid regexp.

See #1189
@jethrokuan
Copy link

I'm not sure what I'm doing wrong here, but I still face the same issue on 0.16-DEV.

I have ignoreFiles = ["^\\.#"] in my config.toml, and not only does livereload not work, refreshing the page does not reflect the changes in the markdown, because the site was not rebuilt.

The output of hugo serve:

❯ hugo serve                                                                                                    09:49:23 PM 
Started building site
0 of 1 draft rendered
0 future content
8 pages created
0 non-page files copied
0 paginator pages created
0 tags created
7 categories created
in 20 ms
Watching for changes in /home/jethro/Code/blog/{content,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Change detected, rebuilding site
2016-03-24 21:51 +0800
Source changed /home/jethro/Code/blog/content/posts/.#building-aagenda.md
^C⏎      

Edit:

From what I see here, it the lock file should be ignored by default.
https://github.com/spf13/hugo/blob/b319c1896907332c542b6cebda596ed63aeca9af/source/filesystem.go#L146-L149

@andrewalexander
Copy link

I have the exact same problem as @jethrokuan. Just did a go get -u -v github.com/spf13/hugo, and I see the relevant lines in fileserver.go have been updated. I also added this to my config.toml: watchIgnoreFiles = ["\\.#(\\w+)\\.(\\w+)"] thinking that I could make it happen with my own regex. And yet, I experience the same no-reload and a notification that the content is changed, but it never actually rebuilds anything since the content wasn't actually updated yet. My hugo server --watch output is a bit different though:

hugo server --watch
Started building site
0 draft content
0 future content
1 pages created
0 non-page files copied
0 paginator pages created
2 tags created
2 categories created
in 24 ms
Watching for changes in /home/andrew/Projects/fancy_new_project/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Change detected, rebuilding site
2016-05-29 15:13 -0400

It doesn't say which file changed, only that a change was detected. Not a true deal-breaker, but when I edit in Sublime, it's really nice to have that live-reload vs. having to kill the hugo process and restart every time while I edit in emacs.

tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
The following inside `config.toml` will ignore files ending with `.foo` and `.boo`.

```
watchIgnoreFiles = [ "\\.foo$", "\\.boo$" ]
```

The above is is a list of Reqular Expressions, but note the escaping of the `\` to make TOML happy.

Fixes gohugoio#1189
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Because this isn't just about server and watching.

See gohugoio#1189
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
And log error on invalid regexp.

See gohugoio#1189
@github-actions
Copy link

github-actions bot commented Apr 4, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants