Should we stop committing the minified JS/CSS?
kaushalmodi opened this issue · comments
Hello,
I find committing the minified files very redundant, just as I'd we were to commit the Hugo binaries too.
The minified JS/CSS files are auto-installed.. so can that step happen on Netlify, in the command
parameter? I do that for my site by wrapping the minification+ Hugo call in a bash script, and then Netlify command contains just that bash script.
- Committing the minified files creates more noise (difficult to review) in commits, and unnecessary file addition to the repo.
- Also, removing those files will reduce merge conflicts. If user1 modified 1.js, and user2 modified 2.js, and you try to merge those 2 PR's,the minified bundle file containing both 1.js and 2.js will unnecessarily cause a merge conflict.
The minified JS/CSS files are auto-installed.
There is nothing automatic about this currently. I agree in principle, but it would require work on the Netlify side...
I don't have a problem with this in general. I typically bundle my production files locally to keep them out of the build process on the server, but that's because my clients care very much about build times.
So, we can move Webpack to the root and set up Netlify to build on push with an NPM script. I'm happy to take this on.
There is nothing automatic about this currently.
Yes, I used the wrong words.. I meant something like "machine generated" when I said auto-generated.. i.e. humans don't need to manually type the minified files :)
but it would require work on the Netlify side...
Yes, but that shouldn't be a big deal compared to the gain in cleaner commits and merges.
Also, you would need to generate those minified files in your release assets deployment script.. if you expect users to just download the release archive, and run hugoDocs locally (without putting the minification burden on them).
just download the release archive, and run hugoDocs locally (without putting the minification burden on them).
They don't have to do that now. JS/CSS are seldom generated on the site because we use utility classes for CSS and we don't have all that much JS.
They don't have to do that now.
Right, I find no reason to run the docs locally unless someone is contributing to it.
I mentioned that only because I read in one of the issues that the gohugo.io domain is blocked in their country.. those users might need to run docs locally.
I may not be understanding where you're going with this. To generate and commit minified JS/CSS locally as we do now, instead of on the build at Netlify, would allow someone to run the docs locally without generating them (and without worrying about errors or instructions because it's just Hugo then). Sorry for being dense. What am I missing?
I think this boils down to:
The other users are more important than us. I kind of hate it myself if I try to use a Hugo theme and it requires some additional Gulp step ...
I hope you can reconsider this because not committing the minified files is the right thing to do.. for the same reasons we don't commit binaries.
How many users do you think clone hugoDocs locally for using docs and not developing? Wouldn't it be better to provide such users with a downloadable docs archive that already has the minified files?