F.Y.I. http://www.cnblogs.com/PeunZhang/p/5553574.html#npm
NPM的全称是Node Package Manager,是随同NodeJS一起安装的包管理和分发工具,它很方便让JavaScript开发者下载、安装、上传以及管理已经安装的包。
npm install -g gulp
Gulp只有 gulp.task(),gulp.src(),gulp.dest(),gulp.watch()
npm install -g cordova ionic
npm install -g uglify-js //这是获取帮助信息 uglifyjs -h
以下是帮助信息的输出结果
D:\gitdev\galaxy>uglifyjs -h C:\Users\Administrator\AppData\Roaming\npm\node_modules\uglify-js\bin\uglifyjs input1.js [input2.js ...] [options] Use a single dash to read input from the standard input. NOTE: by default there is no mangling/compression. Without [options] it will simply parse input files and dump the AST with whitespace and comments discarded. To achieve compression and mangling you need to use `-c` and `-m`. Options: --source-map Specify an output file where to generate source map. [string] --source-map-root The path to the original source to be included in the source map. [string] --source-map-url The path to the source map to be added in //# sourceMappingURL. Defaults to the value passed with --source-map. [string] --source-map-include-sources Pass this flag if you want to include the content of source files in the source map as sourcesContent property. [boolean] --in-source-map Input source map, useful if you're compressing JS that was generated from some other original code. --screw-ie8 Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks (by default UglifyJS will try to be IE-proof). [boolean] --expr Parse a single expression, rather than a program (for parsing JSON) [boolean] -p, --prefix Skip prefix for original filenames that appear in source maps. For example -p 3 will drop 3 directories from file names and ensure they are relative paths. You can also specify -p relative , which will make UglifyJS figure out itself the relative paths between original sources, the source map and the output file. [string] -o, --output Output file (default STDOUT). -b, --beautify Beautify output/specify output options. [string] -m, --mangle Mangle names/pass mangler options. [string] -r, --reserved Reserved names to exclude from mangling. -c, --compress Enable compressor/pass compressor options. Pass options like -c hoist_vars=false,if_return=false . Use -c with no argument to use the default compression options. [string] -d, --define Global definitions [string] -e, --enclose Embed everything in a big function, with a configurable parameter/argument list. [string] --comments Preserve copyright comments in the output. By default this works like Google Closure, keeping JSDoc-style comments that contain "@license" or "@preserve". You can optionally pass one of the following arguments to this flag: - "all" to keep all comments - a valid JS regexp (needs to start with a slash ) to keep only comments that match. Note that currently not *all* comments can be kept when compression is on, because of dead code removal or cascading statements into sequences. [string] --preamble Preamble to prepend to the output. You can use this to insert a comment, for example for licensing information. This will not be parsed , but the source map will adjust for its presence. --stats Display operations run time on STDERR. [boolean] --acorn Use Acorn for parsing. [boolean] --spidermonkey Assume input files are SpiderMonkey AST format ( as JSON). [boolean] --self Build itself (UglifyJS2) as a library (implies --wrap=UglifyJS --export-all) [boolean] --wrap Embed everything in a big function, making the “ exports” and “global” variables available. You need to pass an argument to this option to specify the name that your module will take when included in, say, a browser. [string] --export-all Only used when --wrap, this tells UglifyJS to add code to automatically export all globals. [boolean] --lint Display some scope warnings [boolean] -v, --verbose Verbose [boolean] -V, --version Print version number and exit. [boolean] --noerr Don't throw an error for unknown options in -c , -b or -m. [boolean] --bare-returns Allow return outside of functions. Useful when minifying CommonJS modules. [boolean] --keep-fnames Do not mangle/drop function names. Useful for code relying on Function.prototype.name. [boolean] --reserved-file File containing reserved names [array] --reserve-domprops Make (most?) DOM properties reserved for -- mangle-props [boolean] --mangle-props Mangle property names [boolean] --mangle-regex Only mangle property names matching the regex --name-cache File to hold mangled names mappings [string] --pure-funcs List of functions that can be safely removed if their return value is not used [array] --dump-spidermonkey-ast Dump SpiderMonkey AST to stdout. [boolean] -q, --quotes Quote style (0 - auto, 1 - single, 2 - double, 3 - original)
安装最简单的http server:
npm install -g http-server
启动 在站点目录下开启命令行输入
http-server
使用于package.json
"scripts": { "start": "http-server -a 0.0.0.0 -p 8000", }
参数
-p 端口号 (默认 8080) -a IP 地址 (默认 0.0.0.0) -d 显示目录列表 (默认 'True') -i 显示 autoIndex (默认 'True') -e or --ext 如果没有提供默认的文件扩展名(默认 'html') -s or --silent 禁止日志信息输出 --cors 启用 CORS via the Access-Control-Allow-Origin header -o 在开始服务后打开浏览器 -h or --help 打印列表并退出 -c 为 cache-control max-age header 设置Cache time(秒) , e.g. -c10 for 10 seconds (defaults to '3600'). 禁用 caching, 则使用 -c-1.