[Shock][CLI][Docs] - Load themes from git repositories (Resolves #213) #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Shock][CLI][Docs] - Load themes from git repositories (Resolves #213)
Git theme specification
A git theme is specified by a URL, and an optional path within the repository.
The path is important because it's very likely that a theme will be stored in a subdirectory so that it doesn't include things like the
.gitignore
file at the root. That said, a website could always use anExcluder
to keep files like.gitignore
out of the pipeline.Git theme implementation
Based on initial research, it looks like Git doesn't support any standard repository directory traversal. My hope was that we could navigate the repo over HTTP and only pull down what's picked, but Git doesn't support that.
Instead, we clone the entire theme repository, but we tell git to only bring down the content at the given
path
. This should avoid excessive clone size for things like mono-repos.The theme repo is cloned to the a new root level
.shock/build/
build cache directory. It's contents are added as a source set so that its files can be picked, like the regular source set.Infrastructure changes
.shock
directory at the root of the project structure. I couldn't place it in/build
because that directory is cleared on every build, and also it's meant to be directly deployable. I also didn't want to place it in/source
because it isn't actually source./source/.shock/
is no longer git ignored. We commit it so that things like screenshots don't need to be regenerated in CI, or over time, if not desired.FileRelativePath
s toSourceFile
s because we no longer know that every file exists relative to the primary source directory.