gulpjs 合并 css 及以下

gulpjs merge css and less

我正在尝试将我的 less 文件转换成 css 文件,然后再将其他 css 文件合并成一个 css 文件。我没有收到任何错误,但从未创建 css 文件。有没有办法将两组不同的 css 组合在一起形成一个 css 文件?提前致谢。

var gulp = require("gulp");
var gulpUtil = require("gulp-util");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var less = require("gulp-less");
var minify = require("gulp-minify-css");
var notify = require("gulp-notify");
var addsrc = require("gulp-add-src");

/*CSS Section*/
gulp.task("build-less", function () {

    return gulp.src([
            "Less/common.less",
            "Less/box.less",
            "Less/callout.less",
            "Less/form-controls.less",
            "Less/form.less",
            "Less/scrollbar.less",
            "Less/overflow-table.less",
            "Less/button.less",
            "Less/theme.less",
            "Less/auto-complete.less"
        ]).pipe(less())
        .pipe(addsrc([
            "Css/bootstrap.css",
                "Css/bootstrap-theme.css",
                "Distribution/Styles/theme.css",
                "Css/font-awesome.css",
                "Css/font-awesome-animation.css",
                "Css/animate.css",
                "Css/bootstrap-select.css"
        ]))
        .pipe(concat("dustball.min.css"))
        .pipe(minify())
        .pipe(gulp.dest("Destination/Styles"));
});

刚刚遇到一个名为 merge2 的插件,它起作用了。以下是更新后的版本。

var gulp = require("gulp");
var gulpUtil = require("gulp-util");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var less = require("gulp-less");
var minify = require("gulp-minify-css");
var notify = require("gulp-notify");
var merge = require("merge2");

/*CSS Section*/
gulp.task("build-less", function () {
    var cssFiles = gulp.src([
            "Css/bootstrap.css",
            "Css/bootstrap-theme.css",
            "Distribution/Styles/theme.css",
            "Css/font-awesome.css",
            "Css/font-awesome-animation.css",
            "Css/animate.css",
            "Css/bootstrap-select.css"
        ])
        .pipe(concat("css-files.css"));

    var lessCssFiles = gulp.src([
            "Less/common.less",
            "Less/box.less",
            "Less/callout.less",
            "Less/form-controls.less",
            "Less/form.less",
            "Less/scrollbar.less",
            "Less/overflow-table.less",
            "Less/button.less",
            "Less/theme.less",
            "Less/auto-complete.less"
        ])
        .pipe(less())
        .pipe(concat("less-files.css"));

    return merge(cssFiles, lessCssFiles)
        .pipe(concat("dustball.min.css"))
        .pipe(minify())
        .pipe(gulp.dest("Distribution/Styles"));
});