I was just wondering what ways you’ve come up with to prevent files created with mix phx.digest from being commited with the new default layout of Phoenix 1.6.
I.e. in Phoenix 1.6 static files like images etc go directly into the /priv/static folder by default, and only the generated css and js files in priv/static/assets are ignored in the .gitignore file. So if someone runs mix phx.digest in his development environment and then accidentially just runs git add .; git commit, all those digested files will be commited as well, something I personally find rather annoying.
My solution for now is that I’ve moved the static asset files to assets/static, and am then using watchexec to rsync all changes during development into priv/static. I’ve made a more detailed post about it if someone is interested.
However I’m not entirely happy with this approach, because I actually like the idea of simple layouts, i.e. files are in the same place in development like in production. So my open question is basically: Has anyone of you come up with an alternative to this? I’ve thought about using a git pre-commit hook as well, however that did not work as ex
You could try configuring the pipeline to output in the same folders it used to be?
I honestly don’t know why this was changed tbh. I guess it has something to do with avoiding copying assets over to the priv folder. I also don’t recall reading about the process of changing it when Phoenix 1.6 came out, so as of right now I’ve been using Vite to replace Webpack because I found the transition easier than having almost no frontend pipeline out of the box.
Yeah, that’s bascially what I did, as described in the blog post.
I was just wondering if someone had figured out a good setup where the files go directly into priv/static, maybe with a complicated pre-commit githook or something like that
Hmm, had that idea as well, but for each .gz file a file with the digest is created as well. I.e. → for a file foo.txt we get foo-some-long-digest.txt and foo-some-long-digest.txt.gz.
Hmm, maybe I could find a regex that matches the digests…
So only solution with way things currently work is to put all files that are not generated to a separate folder that you git include so something like this