I’m trying to create my first theme, and at the moment I’m specifically trying to first create a future-proof foundation for any theme, before moving on to the actual theme itself. My relevant repos are:
I want to add my theme to the demo site using modules, and have this work with GitLab Pages and GitLab CI. In order to make this work with the CI, it appears I must vendor the module, which is ffine. I basically had that working, but concluded that I also wanted to be able to locally test pre-commit changes to my theme without having to first commit and push to either remote repo.
So my next thought was to split my module config into separate development and production config directories and files, with development
using the local relative file path on my laptop, and production
using the public GitLab.com theme repo URL. I made a disposable change to my theme locally to verify hugo server
picks up the local theme instead of the remote theme (basically, in a temporary local branch, the site background is yellow; in the file pushed to the remote theme repo, the background is white).
Assuming the solution I am pursuing to testing theme changes locally without pushing to the remote is the right solution, then my main problem now is getting my git pre-push hook to work again now that I have split the module in two. You can see the hugo mod
commands I have used in the sample hook file in the demo site repo. I thought from reading the docs that I could pass an --environment production
flag to the hugo mod
commands but that is not working. The error message is:
% git push lab master ±[master] 2760e01 [lab]
hugo: cleaned module cache for "gitlab.com/puffyn/puffyn-ht"
go: warning: "puffynDemo/..." matched no packages
go get: malformed module path "--environment": leading dash
go get: malformed module path "production": missing dot in first path element
On branch master
nothing to commit, working tree clean
error: failed to push some refs to 'gitlab.com:puffyn/puffyn.gitlab.io.git'
… followed by (on a second push attempt)
% git push lab master ±[master] 832f73d [lab]
hugo: cleaned module cache for "gitlab.com/puffyn/puffyn-ht"
Update module in /run/media/ddg/wmst/mirror_source/ABODE_EXT/Zed_Directory_Ext/Projects_Ext/hugo/sites/puffyn.gitlab.io
flag provided but not defined: -environment
usage: go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]
Run 'go help get' for details.
On branch master
nothing to commit, working tree clean
error: failed to push some refs to 'gitlab.com:puffyn/puffyn.gitlab.io.git'
I basically only want to vendor the production
module that uses the path to the remote repo, while keeping GitLab CI completely unaware of the alternate development
module.
Am I pursuing the best solution/workflow?
If so, then how should I update the pre-push hook file to only vendor the production
module?
Or if I am overlooking a better workflow to achieve my goal of testing local theme changes without pushing them to the remote repo,any insight would be greatly appreciated.
Apart from this core issue, if you happen to notice anything else in my repos that should be changed, any insight is greatly appreciated. For instance, when I move any top-level config option out of a single config file and into a separate dir/file tree, I wasn’t sure if conventions like [[imports]]
should be carried over, or changed to single-bracket variants like [imports]
. I just want my theme and proto-theme foundation to be current idiomatic, best-practices correct code.