5

似乎地图文件指向错误的文件。例如,而不是demo.css它指向example.css

我想我做错了什么?

这是如何为 CSS 缩小和连接定义我的 css 任务的示例:

var gulp = require('gulp');
var rename = require('gulp-rename');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-clean-css');
var gp_concat = require('gulp-concat');
var size = require('gulp-size');

var path ={
    css: './styles/',
    dist: './dist/'
};

gulp.task('css', function() {
    gulp.src([
            './bower_components/aaa.css',
            path.css + 'demo.css',
            path.css + 'example.css',
            path.css + 'another.css'
        ])
        .pipe(sourcemaps.init())
        .pipe(gp_concat('combined.css'))
        .pipe(gulp.dest(path.dist))
        .pipe(minifyCss({
            compatibility: 'ie8',
            advanced: false,
            keepSpecialComments: '1'
        }))
        .pipe(rename({
            suffix: '.min'
        }))
        .pipe(sourcemaps.write({
            includeContent: false,
            sourceRoot: '../styles'
        }))
        .pipe(gulp.dest(path.dist))
        .pipe(browserSync.reload({
            stream: true
        }))
});
4

0 回答 0