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

get.gov 11ty not rebuilding on sass changes #705

Open
igorkorenfeld opened this issue Jun 9, 2023 · 3 comments · May be fixed by cisagov/get.gov#83
Open

get.gov 11ty not rebuilding on sass changes #705

igorkorenfeld opened this issue Jun 9, 2023 · 3 comments · May be fixed by cisagov/get.gov#83
Labels
bug Something that isn't working as intended dev

Comments

@igorkorenfeld
Copy link
Contributor

Ticket Description

While @gabydisarli was testing out the documentation for working with GitHub, she pointed out that the styles were not displaying. In addition to a first-time build, this issue can come up whenever only a .scss file is updated (that is, when there are no changes later made to a .html or .md file). The problem is that when the scss file is changed styles get recompiled into a styles-<hash>.css file with a new cache-busting hash number. Although this is is updated in the assetPaths.json file, the header referencing the stylesheet does not seem to get rebuilt. This results in the header referencing an outdated (i.e. deleted) styles file, so the styles do not pull in. A simple workaround to trigger the header rebuild is to save any .html or .md file. However we should figure out a more robust solution for the build process.

Issue Type

development

Link dependent issues

No response

@igorkorenfeld
Copy link
Contributor Author

Tested out two fixes:

  1. Can remove the assetPaths.json file from the .gitignore
  2. Add a line to the .eleventy.js config to not rely on gitignore for the watch list (i.e. config.setUseGitIgnore(false)).

The drawback to the first solution is that any change will cause the assetPaths.json file to be updated, and marked as changed by git. It doesn't seem to make sense to commit this file, as it just stores a temporary hash.

The draw back to the second solution is that we would need to maintain a separate .eleventyignore file if there is anything else that we would like 11ty to ignore.

In addition to the above, I also tried a couple of things that did not work. I tried adding lines in the config to remove assetPaths.json from the 11ty ignore list in .eleventy.js, and to expliclity watch for it:

config.ignores.delete('_data/assetPaths.json');
config.addWatchTarget('./_data');

I've reached out to the cloud.gov pages team to see if there is another suggestion besides the two solutions above.

@igorkorenfeld
Copy link
Contributor Author

After reaching to the cloud.gov pages team @caleywoods, who worked on the template suggested removing the file from the local gitignore and instead adding it to the global gitignore. This worked great! But if someone doesn't have a global gitignore they would need to create a new file. Another alternative that seems to work is adding the file to the project local .git/info/exclude list

@igorkorenfeld igorkorenfeld linked a pull request Jun 14, 2023 that will close this issue
@kitsushadow kitsushadow added the dev label Jul 3, 2023
@Katherine-Osos Katherine-Osos added the later Not MVP label Jul 27, 2023
@Katherine-Osos
Copy link
Contributor

Marked as "later" due to not being a critical issue.

@Katherine-Osos Katherine-Osos added the bug Something that isn't working as intended label Jul 27, 2023
@vickyszuchin vickyszuchin removed the later Not MVP label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working as intended dev
Projects
Status: 🍦 Backlog
Development

Successfully merging a pull request may close this issue.

4 participants