How to use UglifyJS to uglify a userscript but keep the header ? I have tried --comments option, but not working

// ==UserScript==
// @name        Google Translate Tooltip
// @namespace   steely.wing
// @version     1.4
// @description Translates selected text into a tooltip.
// @license     GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @copyright   2014, Wing Leong (http://steelywing.iblogger.org/)
// @include     *
// @require     http://code.jquery.com/jquery-2.1.0.min.js
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_xmlhttpRequest 
// ==/UserScript==
有帮助吗?

解决方案

This option is working

uglifyjs script.js --comments "/@.*|==\/?UserScript==/"
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top