我已经从Yo库创建了默认的Web项目。 运行命令配置任务运行器时,Mac上的Visual Studio代码出错: “无法在'.vscode'文件夹([object Object])中创建'tasks.json'文件。”
gulpfile.js
/// <binding Clean='clean' />
'use strict';
var gulp = require("gulp"),
rimraf = require("rimraf"),
concat = require("gulp-concat"),
cssmin = require("gulp-cssmin"),
uglify = require("gulp-uglify"),
ts = require('gulp-typescript'),
merge = require('merge'),
project = require("./project.json");
var paths = {
webroot: "./" + project.webroot + "/",
tsSource: './TypeScript/app/**/*.ts',
tsOutput: "./" + project.webroot + '/scripts/app/',
tsDef: "./TypeScript/definitions/"
};
paths.js = paths.webroot + "js/**/*.js";
paths.minJs = paths.webroot + "js/**/*.min.js";
paths.css = paths.webroot + "css/**/*.css";
paths.minCss = paths.webroot + "css/**/*.min.css";
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";
var tsProject = ts.createProject({
declarationFiles: true,
noExternalResolve: false,
module: 'AMD',
removeComments: true
});
gulp.task("clean:js", function(cb) {
rimraf(paths.concatJsDest, cb);
});
gulp.task("clean:css", function(cb) {
rimraf(paths.concatCssDest, cb);
});
gulp.task("clean", ["clean:js", "clean:css"]);
gulp.task("min:js", function() {
gulp.src([paths.js, "!" + paths.minJs], {
base: "."
})
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest("."));
});
gulp.task("min:css", function() {
gulp.src([paths.css, "!" + paths.minCss])
.pipe(concat(paths.concatCssDest))
.pipe(cssmin())
.pipe(gulp.dest("."));
});
gulp.task('ts-compile', function () {
var tsResult = gulp.src(paths.tsSource)
.pipe(ts(tsProject));
return merge([
tsResult.dts.pipe(gulp.dest(paths.tsDef)),
tsResult.js.pipe(gulp.dest(paths.tsOutput))
]);
});
gulp.task('watch', ['ts-compile'], function () {
gulp.watch(paths.tsDef, ['ts-compile']);
});
gulp.task("min", ["min:js", "min:css"]);
答案 0 :(得分:1)
当我看到你的问题时,我再次运行提到的命令,但它失败了。但更新VS代码到版本0.10.16后错误消失;)现在我可以继续使用mac os x上的编程;)