mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-11 23:13:21 -05:00
Minor improvement to translate.js minifier.
This commit is contained in:
parent
1b05623d5a
commit
ba6d15a79d
@ -5,3 +5,11 @@ MD modules_meshcore_min
|
|||||||
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcmd" "modules_meshcmd_min"
|
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" compressalljs "modules_meshcmd" "modules_meshcmd_min"
|
||||||
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcore.js
|
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcore.js
|
||||||
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcmd.js
|
"..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe" meshcmd.js
|
||||||
|
|
||||||
|
REM del meshcore.min.js
|
||||||
|
REM %LOCALAPPDATA%\..\Roaming\nvm\v12.13.0\node ..\translate\translate.js minify meshcore.js
|
||||||
|
REM rename meshcore.js.min meshcore.min.js
|
||||||
|
|
||||||
|
REM del meshcmd.min.js
|
||||||
|
REM %LOCALAPPDATA%\..\Roaming\nvm\v12.13.0\node ..\translate\translate.js minify meshcmd.js
|
||||||
|
REM rename meshcmd.js.min meshcmd.min.js
|
@ -387,7 +387,11 @@ function startEx(argv) {
|
|||||||
// Minify the file
|
// Minify the file
|
||||||
if (minifyLib = 2) {
|
if (minifyLib = 2) {
|
||||||
var inFile = fs.readFileSync(outname).toString()
|
var inFile = fs.readFileSync(outname).toString()
|
||||||
|
|
||||||
|
// Perform minification pre-processing
|
||||||
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
|
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
|
||||||
|
if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; }
|
||||||
|
|
||||||
var minifiedOut = minify(inFile, {
|
var minifiedOut = minify(inFile, {
|
||||||
collapseBooleanAttributes: true,
|
collapseBooleanAttributes: true,
|
||||||
collapseInlineTagWhitespace: false, // This is not good.
|
collapseInlineTagWhitespace: false, // This is not good.
|
||||||
@ -404,6 +408,9 @@ function startEx(argv) {
|
|||||||
preserveLineBreaks: false,
|
preserveLineBreaks: false,
|
||||||
useShortDoctype: true
|
useShortDoctype: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Perform minification post-processing
|
||||||
|
if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); }
|
||||||
if (outname.endsWith('.handlebars') >= 0) { minifiedOut = minifiedOut.split('"{{{pluginHandler}}}"').join('{{{pluginHandler}}}'); }
|
if (outname.endsWith('.handlebars') >= 0) { minifiedOut = minifiedOut.split('"{{{pluginHandler}}}"').join('{{{pluginHandler}}}'); }
|
||||||
fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
|
fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user