NPM 模块恩仇录
vue-clickoutside
点击元素以外的东西时会触发的事件。好东西。其实可以利用全局event来判断当前点击的对象来判断也一样。但这个显然更舒服
传送门:https://www.npmjs.com/package/vue-clickoutside
request-promise
request + promise的衍生版
npm install --save request
npm install --save request-promise
传送门:https://github.com/request/request-promise
传送门:http://www.cnblogs.com/CyLee/p/6564175.html
anywhere
一句话:随时随地将你的当前目录变成一个静态文件服务器的根目录。
安装
npm install anywhere -g
anywhere -h localhost -p 8060
fastclick
// 这个插件特别常用,解决手机端 click点击延迟
import fastclick from 'fastclick'
fastclick.attach(document.body)
v-tap 支持手机端和Pc端的点击事件
github地址:https://github.com/MeCKodo/vue-tap
import vueTap from 'v-tap';
Vue.use(vueTap)
使用方法:v-tap="{methods:change_title}" / v-tap="{ methods:open,k : item.key,i:index2}"
change_title (para) {
var e = para.event;
console.log(e);
$(e.target).text()
}
process
第三方学习地址:http://www.css88.com/archives/4548
process模块用来与当前进程互动,可以通过全局变量process访问,不必使用require命令加载。
通常会使用process.env.xxxx来存储全局配置
- process.env:指向当前shell的环境变量,比如process.env.NODE_ENV。
- process.argv:当前进程的命令行参数数组。
gulp-nodemon 和 nodemon
官方网站:http://nodemon.io/
github地址:https://github.com/remy/nodemon/
简介:Nodemon 是一款非常实用的工具,用来监控你 node.js 源代码的任何变化和自动重启你的服务器。 Nodemon 是一款完美的开发工具
作用:自动启动/重启你的node程序,开发node服务端程序必备
安装:
npm install -g nodemon npm install -g gulp-nodemon
demo:
nodemon({ script: path.join(__dirname,'/server.js'), ext: 'js', watch: [ path.join(__dirname,'/dist') ], env: { 'NODE_ENV': 'production','PORT':PROD_PORT } })
open 和 opn
github地址:https://github.com/sindresorhus/opn
简介:打开的网站、文件之类的可执行文件。
安装:
npm install open
npm install --save opn
demo:
open('http://localhost:' + DEV_PORT)
gulp-sequence
github地址:https://github.com/teambition/gulp-sequence
简介:gulp的任务的执行是异步的。通过该模块实现顺序执行
作用:让gulp任务,可以相互独立,解除任务间的依赖,增强task复用
安装:
npm install --save-dev gulp-sequence
demo:
gulp.task('webpack:dist',gulpSequence('set-env-prod','webpack'))
del
github地址:https://github.com/sindresorhus/del
简介:删除文件
作用:删除文件/文件夹
安装:
$ npm install --save del
demo:
del([path.join(__dirname, '/dist/*')])
path
第三方学习地址:http://www.jianshu.com/p/fe41ee02efc8
简介:提供关于路径的函数
//引用该模块 var path = require("path"); //路径解析,得到规范化的路径格式 var myPath = path.normalize(__dirname + '/test/a//b//../c/utilyou.mp3'); console.log(myPath); //windows: E:\workspace\NodeJS\app\fs\test\a\c\utilyou.mp3
相关文章
- [web 前端] Npm package.json与package-lock.json文件的作用
- [Web 前端] 使用yarn代替npm作为node.js的模块管理器
- VUE - 引入 npm 安装的模块 以及 uuid模块的使用
- 在Windows平台上安装Node.js及NPM模块管理
- Node.js 笔记(一) nodejs、npm、express安装
- npm安装同一个包的2个版本
- [NPM] Execute npx commands with $npm_ Environment Variables
- [Tool] Open Multiple Terminal Tabs on npm Start with ttab and npm-run-all
- [NPM] Make npm scripts cross-environment friendly
- [NPM] Run npm scripts when files change with onchange
- [NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all
- [NPM] Execute npx commands with $npm_ Environment Variables
- [NPM] Set default values for package.json using npm set
- [NPM] Update published npm packages using np
- [NPM] Test npm packages locally in another project using npm link
- [NPM] Add comments to your npm scripts
- [NPM] Make npm scripts cross-environment friendly
- [NPM] Run npm scripts with git hooks
- [NPM] Pipe data from one npm script to another
- 在mac上安装cnpm一直报错!Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! { [
- 当运行npm install 命令的时候带上ignore-scripts,会发生什么?
- npm run dev 启动错误:Module build failed: Error: No PostCSS Config found in:xxxxxxxxxxxxxx
- nvm安装node和npm,个人踩坑记录
- npm 安装参数中的 --save-dev 是什么意思