Gulp编译的css文件为空

时间:2016-02-04 10:31:05

标签: sass gulp

我是Gulp的新手,我在VS2015中使用它,使用TaskRunnerExplorer。

这是包含路径的配置文件:

    config = {

base: '',
webRoot: rootPath,
paths: {
    source: {
        js: rootPath + 'Views/**/*.js',
        bundleJs: rootPath + 'wwwroot/scripts/app/**/*.js',
        minJs: rootPath + '**/*.min.js',
        testJs: rootPath + '**/*.test.js',
        e2eJs: rootPath + '**/*.spec.js',
        bundleScss: rootPath + 'wwwroot/css/src/**/*.scss',// where the bundled scss files are
        viewsScss: rootPath + 'Views/**/*.scss', // where the individual scss of each subfolder of Views folder
        bundleCss: rootPath + 'Views/bundledcss.style.min.css', //the unique file that agregates the min.css files
        viewsCss: rootPath + 'Views/**/*.min.css',
        minCss: rootPath + 'wwwroot/css/**/*.min.css', // the minified css path
        libCss: rootPath + 'wwwroot/css/lib/*.css',
        libJs: rootPath + 'wwwroot/scripts/lib/*.js'
    },
    output: {
        js:{
            bundle: rootPath + 'Views',
            views: rootPath + 'Views'
        },
        css:{
            bundle: rootPath + 'Views',
            views: rootPath + 'Views'
        },
        lib: {
            js:rootPath + 'wwwroot/scripts/lib',
            css: rootPath + 'wwwroot/css/lib',
            font: rootPath + 'wwwroot/css/fonts/'
        }
    },

这是gulp文件(部分)

var gulp    = require('gulp'),

//Node modules
console         = require('better-console'),

// gulp plugins
sass            = require('gulp-sass'),
rename          = require('gulp-rename'),
autoprefixer    = require('gulp-autoprefixer'),
minifyCss       = require('gulp-minify-css'),
plumber         = require('gulp-plumber'),
gulpif          = require('gulp-if'),


// Configuration
config  = require('../../config');

module.exports = function(isRelease) {
return function () {
    var stream = gulp.src(config.paths.source.viewsScss) 
        .pipe(plumber())
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer())               
        .pipe(gulpif(isRelease,minifyCss()))
        .pipe(rename(config.rename.minCSS)) 
        .pipe(gulp.dest(config.paths.output.css.views));

    return stream;
};
};

我想在Views文件夹的每个子文件夹中编译sass文件,但每个子文件夹中生成的min.css文件为空。我错过了一步吗?提前谢谢。

0 个答案:

没有答案