2015-10-17 53 views
1

我從Yo庫創建了默認Web項目。 當運行命令Configure Tasks Runner: 「無法在'.vscode'文件夾([object Object])中創建'tasks.json'文件時,我在Mac上的Visual Studio代碼中出錯。」在Mac上使用Visual Studio代碼配置Tasks Runner使用Gulp

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"]); 
+1

你解決了嗎? –

+0

當我看到你的問題時,我再次運行提到的命令,失敗了。但在更新VS代碼到版本0.10.16後,錯誤消失;)現在我可以繼續在mac os x上編程了;) – netmajor

回答

1

當我看到你的問題我再跑提到的命令,但失敗。但更新後的VS代碼版本0.10.16錯誤消失;)現在我可以繼續在mac os x上編程;)

相關問題