【发布时间】:2020-04-17 23:48:10
【问题描述】:
我是 gruntjs 的新手,很难理解为什么简单的复制文件任务不起作用。下面是我在 Gruntfile.js 中的代码。
module.exports = function (grunt) {
"use strict";
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
// copy other css files
copy: {
dist: {
files: {
//expand: true, // required when using cwd
//cwd: ['.'], // set working folder / root to copy
src: './wwwroot/lib/html5-reset/assets/css/reset.css', // copy all files and subfolders
dest: './wwwroot/css/' // destination folder
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.registerTask("copyCss", ["copy"]);
};
当我执行任务时出现以下错误
正在加载“Gruntfile.js”任务...确定
+ 复制CSS
运行任务:复制
运行“复制”任务
运行“copy:dist”(复制)任务
验证属性 copy.dist 是否存在于配置中...确定
文件:./wwwroot/lib/html5-reset/assets/css/reset.css -> src
文件:./wwwroot/css/ -> dest
选项:encoding="utf8"、processContent=false、processContentExclude=[]、timestamp=false、mode=false
复制 ./wwwroot/lib/html5-reset/assets/css/reset.css -> src
正在阅读 ./wwwroot/lib/html5-reset/assets/css/reset.css...OK
写入 src...错误
警告:无法写入“src”文件(错误代码:EISDIR)。使用 --force,继续。
完成,但有警告。
进程以代码 0 终止。
感谢您帮助查明问题。
【问题讨论】:
-
你想复制什么?是否要将名为
reset.css的文件从wwwroot/lib/html5-reset/assets/css/目录复制到./wwwroot/css/目录?还是别的什么? -
是的,我正在尝试将 html5-reset css 文件从 lib 文件夹复制到 css 文件夹。
标签: gruntjs grunt-contrib-copy asp.net-core-3.1