Some resources/_gen files are being tracked in git despite my efforts to ignore them, such as:
resources/_gen/assets/scss/scss/styles.scss_11f2c63bd600bdcb1fe9231df61b9210.content
resources/_gen/assets/scss/scss/styles.scss_11f2c63bd600bdcb1fe9231df61b9210.json
I’m unsure what I’m doing wrong here, as each change to the CSS is also tracking these files, which I don’t think is necessary. Or at least I don’t want that to happen.
I’m using fingerprinting in Sass pipes generation, like so:
{{ $options := (dict "targetPath" "css/styles.css" "enableSourceMap" true) }}
{{ $style := resources.Get "scss/styles.scss" | resources.ToCSS $options | fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" media="screen">
My .gitignore has this line:
resources/
Is there anything else in .gitignore file?
What is the path to your .gitignore file?
Do you have .gitignore files in multiple directories?
A link to the public repository for your site would be helpful.
Thanks for the reply. Unfortunately my project is not public at this time. Here is my full .gitignore:
# Logs
log.html
npm-debug.log
# Dependency directories
node_modules/
.bundle
/public/
public/
build/
resources/
!content/resources/
!layouts/resources/
*.css.map
.DS_Store
*.map
*.js.map
.sass-cache/
.sass-cache
.gulp-cache
*.scssc
*.sublime*
.vscode/
.project/
config.codekit3
The .gitignore file is in my Hugo project root.
From the root of your project, type:
git check-ignore <path-to-file-you-are-curious-about>
If the path is ignored, it will be printed after the command executes. If it is not ignored, nothing will print.
Another question… is it possible that you started tracking these particular files before you added resources/ to your .gitignore file?
The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked. Files already tracked by Git are not affected; see the NOTES below for details.
To stop tracking a file that is currently tracked, use git rm --cached .
https://git-scm.com/docs/gitignore#_description
https://git-scm.com/docs/gitignore#_notes
That looks like the issue here. They were files that were added again at some point, and un-tracking them seems to have worked.
Thanks!