-
Notifications
You must be signed in to change notification settings - Fork 42
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
Prevent overwriting the manifest in the first phase of the build #63
base: master
Are you sure you want to change the base?
Prevent overwriting the manifest in the first phase of the build #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this! I authored à related bug fix but looks like yours is a better soltion
@@ -29,10 +29,11 @@ def ignored? | |||
private | |||
|
|||
def manifest_content | |||
if @source_file.nil? | |||
path = File.join(@app.config[:build_dir], @destination_path) | |||
if !File.exist?(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick but this would be generally easier to understand using the positive form:
if File.exists?(path)
do B
else
do A
end
Instead of if !x do A else do B
Any news on merging this? |
Since we store the optimization manifest in the
build
directory, and since it doesn't have a counterpart in thesource
directory theManifestResource
needs to behave a little differently than your average resource. Instead of reading a file fromsource
and writing it tobuild
we want to read frombuild
if the file already exists, so that we preserve the contents of that file through the first stage of the build.In one of my projects this PR takes a 22 minute build down to 2 minutes.
Fixes #60
Fixes #41, Closes #58 (Specifying the manifest path shouldn't be needed if we don't overwrite it, and storing it outside the build directory doesn't exactly make sense since it is an artifact of a particular build, or sequence of builds. To say it another way, if you used an existing manifest with an empty build directory you'd end up skipping optimization of images that would need to be optimized.)