-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
cmd mistakenly running on TS Files, not input file only #532
Comments
Note, this was with v2.12.1. With v2.3.6, this issue does not occur. |
Confirmed on Windows and macOS. Not sure what the "copy 'x' to 'y'" line is about yet. |
The issue seems to be caused by a
There are two questions I have:
Original code (below line 480 in main.go): //...
if !verbose {
Info.Println(file, "changed")
}
task, err := NewTask(root, file, output, !fileMatches(file))
if err != nil {
Error.Println(err)
return 1
}
chanTasks <- task
//... My proposed changes: //...
if !verbose {
Info.Println(file, "changed")
}
if !fileMatches(file) {
break
}
task, err := NewTask(root, file, output, sync)
if err != nil {
Error.Println(err)
return 1
}
chanTasks <- task
//... Implementing the code above does prevent the "copy 'x' to 'y'" output logging and the
|
In regards to the double output logging. It looks like minify is noticing the change to the source file, My previously provided code could be modified as follows to ignore changes to the output file: //...
if !verbose {
Info.Println(file, "changed")
}
if !fileMatches(file) {
break
}
//Ignore if file changed is the output file. Change was most likely caused by minify!
if file == output {
break
}
task, err := NewTask(root, file, output, sync)
if err != nil {
Error.Println(err)
return 1
}
chanTasks <- task
//... |
Thanks for all the efforts, let me come back to this during the week
…On Sat, 17 Sep 2022, 13:49 c9845, ***@***.***> wrote:
In regards to the double output logging. It looks like minify is noticing
the change to the source file, script.js, and minifying it to
script.min.js (as expected). minify is then noticing the change to
script.min.js and running again! minify is not ignoring its own output
file!
—
Reply to this email directly, view it on GitHub
<#532 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKOGHRUDKYJQJ5Y7TJ257TV6XZA5ANCNFSM6AAAAAAQNZG77Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Looked into this a bit further. It is not just JS (or TS) related, this also affects CSS. I imagine that means it effects all file types. If I have a directory with styles.css on which I will use |
Let me know if this fixes your issue. I've fixed various problems with watching file changes. |
Your recent changes do not resolve the issue. I continue to see the "copy 'x' to 'y'" logging output and the file being changed is copied to the minify output file. |
My mistake, your changes do fix the file copying. I had installed via Thanks! |
My directory structure is a flat tree with source .ts files. These .ts files get combined into script.js by
tsc
. My goal is to haveminify
watch the script.js file and minify it toscript.min.js
in the same directory.When I run
minify -w -v -o website/static/js/script.min.js website/static/js/script.js
, I get output like "copy website\static\js\common.ts to website\static\js\script.min.js" showing thatminify
is running on a change to the common.ts file. However,minify
should only be running on changes to the script.js file per the command. To confirmminify
is running on (and copying) .ts files, I can see that the script.js file contains the .ts file's contents for a brief time untiltsc
completes,minify
notices the updated script.js, and the minifies it.So my question is, why is
minify
running on a change to a .ts file if the command specifically notes it should run on changes to script.js?Complete output is below for a single file change:
The text was updated successfully, but these errors were encountered: