每天都要开心哦~~~
今天来个双语文档
先来说一下npm 执行的方式
1.首先,进入项目目录,下载依赖,添加到dev依赖
1.First, Go to your application project, Install copyfiles dependency with the below command Note: please add this as devDependencies using –save-dev
npm install --save-dev copyfiles
2.把下面代码放到你的package.json,就像下图那个样子
2.In the package.json file, There is a script tag, add below line of code
"scripts": {
"copy": "copyfiles source destination"
}
3.最后,我们可以用npm run copy命令进行拷贝文件操作啦~~
3.Finally, You can script by calling npm run copy command in terminal
4.npm copyfiles examples
4.自定义拷贝案例
- 来看一些案例吧~discuss some examples
- 拷贝文件到某个目录copy specific files into directory
- 假如你的js文件放在src/assets,你怎么只拷贝里面的JS文件到另一个目录呢?
- Suppose you have a javascript file in src/assets folder. How do you copy only javascript files to the output directory
"copyjavascript": "copyfiles src/assets/*.js destination"
- 尝试一下下面的命令,感受一下吧~~
npx copyfiles dist test
npx copyfiles dist/spa/assets/*.js out
npx copyfiles dist/spa/* out
npx copyfiles dist/spa/* test
npx copyfiles dist/spa test
npx copyfiles dist/spa test -a
npx copyfiles -a dist/spa test
npx copyfiles -a dist/spa/assets/* test
接下来说一下我们使用node命令执行脚本命令的方式
const copyfiles = require('copyfiles');
const copyEnd = () => {
console.log('我拷贝完啦~~~');
};
// 这个命令是针对根目录的哦
copyfiles(['dist/spa/assets/*.js', 'out'], { all: true }, copyEnd);
- 运行代码
node scripts/copy.js
- 今天就写到这里啦~小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~
- 大家要天天(▽)哦
欢迎大家指出文章需要改正之处~
学无止境,合作共赢
欢迎路过的小哥哥小姐姐们提出更好的意见哇~~
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。