4. npm 사용해보기
페이지 정보
작성자 관리자 댓글 0건 조회 1,236회 작성일 19-04-01 21:28본문
4. npm 사용해보기
npm install <패키지> -g
-g 옵션은 전역적으로 사용할 수 있게 설치한다. 생략시 현 패키지 로컬에 설치된다.
root@leelab:/opt/server_side_javascript# npm install uglify-js -g
/usr/local/bin/uglifyjs -> /usr/local/lib/node_modules/uglify-js/bin/uglifyjs
/usr/local/lib
└─┬ uglify-js@3.5.3
├── commander@2.19.0
└── source-map@0.6.1
root@leelab:/opt/server_side_javascript#
root@leelab:/opt/server_side_javascript# uglifyjs --help
Usage: uglifyjs [options] [files...]
Options:
-V, --version output the version number
-p, --parse <options> Specify parser options.
-c, --compress [options] Enable compressor/specify compressor options.
-m, --mangle [options] Mangle names/specify mangler options.
--mangle-props [options] Mangle properties/specify mangler options.
-b, --beautify [options] Beautify output/specify output options.
-o, --output <file> Output file (default STDOUT).
--comments [filter] Preserve copyright comments in the output.
--config-file <file> Read minify() options from JSON file.
-d, --define <expr>[=value] Global definitions.
-e, --enclose [arg[,...][:value[,...]]] Embed everything in a big function, with configurable argument(s) & value(s).
--ie8 Support non-standard Internet Explorer 8.
--keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name.
--name-cache <file> File to hold mangled name mappings.
--rename Force symbol expansion.
--no-rename Disable symbol expansion.
--self Build UglifyJS as a library (implies --wrap UglifyJS)
--source-map [options] Enable source map/specify source map options.
--timings Display operations run time on STDERR.
--toplevel Compress and/or mangle variables in toplevel scope.
--verbose Print diagnostic messages.
--warn Print warning messages.
--wrap <name> Embed everything as a function with “exports” corresponding to “name” globally.
-h, --help output usage information
root@leelab:/opt/server_side_javascript#
root@leelab:/opt/server_side_javascript# vi pretty.js
function hello(name){
console.log('Hi,'+name);
}
hello('jklee');
root@leelab:/opt/server_side_javascript# uglifyjs pretty.js
function hello(name){console.log("Hi,"+name)}hello("jklee");
root@leelab:/opt/server_side_javascript#
root@leelab:/opt/server_side_javascript# uglifyjs pretty.js -m
function hello(l){console.log("Hi,"+l)}hello("jklee");
root@leelab:/opt/server_side_javascript#
root@leelab:/opt/server_side_javascript# uglifyjs pretty.js -m -o uglified.js
root@leelab:/opt/server_side_javascript# cat uglified.js
function hello(l){console.log("Hi,"+l)}hello("jklee");
root@leelab:/opt/server_side_javascript#
root@leelab:/opt/server_side_javascript# uglifyjs pretty.js -m -o pretty.min.js
root@leelab:/opt/server_side_javascript#
댓글목록
등록된 댓글이 없습니다.