-
Notifications
You must be signed in to change notification settings - Fork 192
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
Set up dist folders and serve static assets from there #839
Comments
Yeah, there should be a better way to do this (I hope).
That's news to me. I assume this is on Windows for you? Could it be that the Windows and Mac optimizations are not binary-equivalent? |
Any ideas on how we could improve this, @magsout? One idea is we could just make this grunt task a non-default task (that is run when building for a deploy). |
Why not send all output from the build process into ./dist or ./built_site or some such? Would it be hard to only optimize images that are newer than already optimized file inside ./dist ? |
Most likely. I guess if I did check them in you'd end up seeing this issue on your side. git ping pong? :) |
Hm, probably not. We could have the task move them to One minor wrinkle is this would allow us to check in large unoptimized files into the repo. I don't know if that will be an real issue in practice though. |
/me thinks that's a feature :-p Another thing: I'm quite often using "Search in files" to get an overview of the code, and the way our build process keeps built files and source files pretty close in the tree is annoying. It's hard - especially while being newbie - to tell which files are the output of a build process and which aren't. Making sure all output goes to ./dist would be a great improvement. |
I'm gonna take this and do the following:
And then I'll see if my "check the last-modified date on those before running the task" plan is annoying to implement or not. |
I just checked, and imagemin doesn't actually overwrite them or optimize them if there's no gains to be made. But it still spends time attempting to optimize them. |
imagemin takes a while to run on Windows and outputs a message saying "n images optimized, 0 bytes saved". Afterwards Git thinks those files were modified. So it's weird :-p |
The joys of cross-OS tooling. 🔨 |
So, thinking more about this it's gonna be a number of hours to make a fix that saves about a minute per build. I guess that adds up, but I propose the following simpler approach: make imagemin non-default but always included for deploys. We can re-visit a |
To avoid these issues, I always avoid touching the original file. I have a build directory with css, js, img, svg etc .. This directory is of course not track by git. |
Maybe we can thinking about migrate to webpack (a good solid webstack) with lot of loader (svg, img, js, css) .. |
I agree with @magsout, but it might be a while before we get to webpack. If someone wants to tackle this as an opportunity to mess with grunt and some templates, I think the plan from #839 (comment) would still work. You would need to create a We probably want to add dist to gitignore too. |
Related to #1352 |
I think we don't want to do this anymore. |
The build process job for optimizing jpg and png images overwrites the originals. It's odd to run the optimizations again and again on those same files, and it's annoying that Git actually thinks some of them have changes that should be checked in.
The text was updated successfully, but these errors were encountered: