htmlcssjs专用压缩用minify,让代码都变成一行,去除所有的空格,变得更精简用代码合并

htmlcssjs压缩min

安装模块

command + shift + x输入minify并安装第一个

快捷键

command+shift+p,调出命令窗口,输入minify*.css会在当前目录下会生成*.min.css

效果

源代码

1
2
3
4
5
6
7
8
9
* {
/*系统默认菜单被禁用*/
-webkit-touch-callout: none; /*webkit浏览器*/
-webkit-user-select: none; /*早期浏览器*/
-khtml-user-select: none; /*火狐*/
-moz-user-select: none; /*IE10*/
-ms-user-select: none;
user-select: none;
}

压缩后代码

1
*{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}

合并代码

1.选中代码

2.command+shift+p,调出命令窗口,输入join lines,确认执行就可以合并所选中代码

3.里面有行注释的,合并后无法运行代码

合并前

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 禁止右键菜单
document.oncontextmenu = function () {
return false;
};
// 禁止文字选择
document.onselectstart = function () {
return false;
};
// 禁止复制
document.oncopy = function () {
return false;
};
// 禁止剪切
document.oncut = function () {
return false;
};
// 禁止粘贴
document.onpaste = function () {
return false;
};

合并后

1
// 禁止右键菜单 document.oncontextmenu = function () { return false; }; // 禁止文字选择 document.onselectstart = function () { return false; }; // 禁止复制 document.oncopy = function () { return false; }; // 禁止剪切 document.oncut = function () { return false; }; // 禁止粘贴 document.onpaste = function () { return false; };