You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Names of files processed by Minify plugin can't contain Special characters (, ).
Also, more special character, like * can't be used in arguments.
environment: Windows
possible solution:
check escaping of ( )
avoid CMD shell
I also included my work-around.
Although it can't be used to fix the problem, maybe it will come useful for testing the issue.
Or for someone to use it as a workaround.
I was not able to un-minify files which name include brackets: assets_manifest (8).min.js
It's also not possible to use * to define comments to remove in plugin option file: "comments_to_keep": "/^(?!XXX).*$/"
The error dialog shows that brackets are being escaped ^^(8^^), but this doesn't do the trick, at least on my PC.
node.js doesn't have a problem with these characters, they only needs to be escaped/avoided
because of a CMD (BAT) file, or more specifically CMD shell.
The process is, that
Minify plugin by default calls uglifyjs, Windows will find uglifyjs.cmd in a folder added to PATH environment variable.
Here: C:\Users\Papo\AppData\Roaming\npm\uglifyjs.cmd
this bat will in return call: node "%~dp0\node_modules\uglify-js\bin\uglifyjs" %*
To avoid the CMD shell, I tried to define the command in Minify plugin: "uglifyjs_command": "node C:\\Users\\Papo\\AppData\\Roaming\\npm\\node_modules\\uglify-js\\bin\\uglifyjs"
But the same problem with ^^( caused error (screenshot below)
The plugin(?) is trying to escape the brackets.
(maybe it can decide if do escape based on presence of bat/cmd extension in uglifyjs_command)
So I did a PowerShell script, where I translated the contents of the uglify.cmd and
as PowerShell doesn't have a problem with (), I removed the ^^ from all arguments.
I than added:
"uglifyjs_command": "PowerShell.exe -ExecutionPolicy Unrestricted -File C:\Users\Papo\AppData\Roaming\npm\uglifyjs.ps1"
and now I can minimize/un-minimize files with () in their names.
also, I can use * (I haven't tested comments_to_keep with * yet, but * shows in a log file)
there is one weirdness though, the single ^ from: "comments_to_keep": "/^(?!XXX).*$/", is missing.
log doesn't show it, so it probably gets removed before the ps1 script
Guys, I feel your pain! I also use Windows myself and it is really tough to properly escape some commands and/or command arguments.
The Minify plugin for SublimeText is a multi platform plugin. It must work not only in Windows, but in OS X and Linux, too. What also complicate things is Python. All SublimeText plugin must be written in Python as far as I know and how Python deals with command line arguments and their escaping on various platforms is pretty much unpredictable, IMHO.
But if someone can come up with a good, multi platform safe solution to this escaping issue and submits a Pull request then I am not against merging that and then testing that.
Other then that, I must say that it is probably easier to rename those files which have spacial characters such as brackets in their file name. Don't you think? (E.g. Total Commander can do multi file renames.)
Names of files processed by Minify plugin can't contain Special characters
(
,)
.Also, more special character, like
*
can't be used in arguments.environment: Windows
possible solution:
I also included my work-around.
Although it can't be used to fix the problem, maybe it will come useful for testing the issue.
Or for someone to use it as a workaround.
I was not able to un-minify files which name include brackets:
assets_manifest (8).min.js
It's also not possible to use
*
to define comments to remove in plugin option file:"comments_to_keep": "/^(?!XXX).*$/"
The error dialog shows that brackets are being escaped ^^(8^^), but this doesn't do the trick, at least on my PC.
node.js doesn't have a problem with these characters, they only needs to be escaped/avoided
because of a CMD (BAT) file, or more specifically CMD shell.
The process is, that
Minify plugin by default calls
uglifyjs
, Windows will find uglifyjs.cmd in a folder added to PATH environment variable.Here: C:\Users\Papo\AppData\Roaming\npm\uglifyjs.cmd
this bat will in return call:
node "%~dp0\node_modules\uglify-js\bin\uglifyjs" %*
To avoid the CMD shell, I tried to define the command in Minify plugin:
"uglifyjs_command": "node C:\\Users\\Papo\\AppData\\Roaming\\npm\\node_modules\\uglify-js\\bin\\uglifyjs"
But the same problem with ^^( caused error (screenshot below)
The plugin(?) is trying to escape the brackets.
(maybe it can decide if do escape based on presence of bat/cmd extension in uglifyjs_command)
So I did a PowerShell script, where I translated the contents of the uglify.cmd and
as PowerShell doesn't have a problem with (), I removed the ^^ from all arguments.
I than added:
"uglifyjs_command": "PowerShell.exe -ExecutionPolicy Unrestricted -File C:\Users\Papo\AppData\Roaming\npm\uglifyjs.ps1"
and now I can minimize/un-minimize files with () in their names.
also, I can use * (I haven't tested comments_to_keep with * yet, but * shows in a log file)
there is one weirdness though, the single
^
from:"comments_to_keep": "/^(?!XXX).*$/",
is missing.log doesn't show it, so it probably gets removed before the ps1 script
The text was updated successfully, but these errors were encountered: