[NPM] Pass arguments to npm scripts
2024-09-01 03:30:47
Often times you’ll have variations that you’ll want to make to your npm scripts and repeating yourself is inefficient and verbose. Instead you can create a base script and pass arguments into it from another script.
For example, you have a script:
"test": "mocha spec/ --require babel-register",
And you want to add a watcher to the test script:
"test:watch": "mocha spec/ --require babel-register --watch",
Here what we do is copy the script and add a '--watch' behind. This is not good enough, because if you want to change the 'test' script, you also need to modify the 'test:watch' script.
So what you can do:
"test:watch": "npm t -- --watch"
First '--' tell the compiler that we still need to pass in some arguments; And '--watch' is what we want to pass in.
最新文章
- 将bean转换成键值列表
- Js经典相册
- Action处理请求参数
- JavaScript基础篇
- javascript原型Prototype
- Lua从入门到精通
- window下配置SSH连接GitHub、GitHub配置ssh key(转)
- 百度上传插件WebUploader,angularjs指令封装
- iPhone开发:Objective C 代码规范-iOS总结版
- chrome extensions
- .NET C#到Java没那么难,DB篇
- SqlHelper工具类
- F#周报2019年第11期
- Linux SVN 操作详解(转)
- mysql学习笔记--数据库视图
- python学习笔记之自定义函数的导入
- 洛谷 P1441 砝码称重
- 20145215《网络对抗》Exp7 网络欺诈技术防范
- php中cal_days_in_month不可用时的替代方法(计算一个月的天数)
- 转【面向代码】学习 Deep Learning(二)Deep Belief Nets(DBNs)
热门文章
- 设计模式六大原则(五):迪米特法则(Law Of Demeter)
- 洛谷——U10783 名字被和谐了
- 洛谷 P2819 图的m着色问题
- IntelliJ IDEA 2018 Community(社区版)创建J2EE项目+Tomcat9部署
- 关于数据库中的JOIN的用法学习
- 洛谷 P2118 比例简化
- 2.CCGridAction(3D效果),3D反转特效,凸透镜特效,液体特效,3D翻页特效,水波纹特效,3D晃动的特效,扭曲旋转特效,波动特效,3D波动特效
- 24、驱动调试之printk
- linux 安装完mysql 密码重置
- FeatureLayer,FeatureDataset,FeatureClass,Feature的区别与联系总结