У меня есть следующая структура папок и файлов:
Vendor
bootstrap
css
-bootstrap.css
js
-bootstrap.js
font-awesome
css
-font-awesome.css
nivo-slider
-nivo-slider.css
theme
-theme.css
-theme-animate.css
-theme-blog.css
-theme-responsive.css
-theme-shop.css
Я пытаюсь убедиться, что файлы css добавляются в поток именно в таком порядке:
1) Файл bootstrap.css
src/vendor/bootstrap/css/bootstrap.css
2) Все остальные файлы css внутри подкаталогов 'src/vendor/' в произвольном порядке (в будущем я добавлю больше, поэтому не хочу делать это слишком конкретным)
src/vendor/font-awesome/css/font-awesome.css
src/vendor/nivo-slider/nivo-slider.css
3) Эти определенные файлы css внутри каталога 'src/vendor/theme/' в произвольном порядке
src/vendor/theme/theme.css
src/vendor/theme /theme-animate.css
src/vendor/theme/theme-blog.css
src/vendor/theme/theme-shop.css
4) И, наконец, файл theme-responsive.css
src/vendor/theme/theme-responsive.css
Вот моя попытка:
var gulp = require('gulp');
var streamqueue = require('streamqueue');
gulp.task('styles', function() {
var stream = streamqueue({ objectMode: true });
// file that needs to be at the beginning of the concatenated css file
stream.queue(
gulp.src('src/vendor/**/bootstrap.css')
);
//Now I want to add most of the remaining files, except for the bootstrap.css file that was already added as well as any files with the word theme at the beginning of it
stream.queue(
gulp.src('src/vendor/**/*.css', '!src/vendor/**/bootstrap.css', '!src/vendor/**/theme*.css')
);
//Now I would like to add the files that begin with the word theme at the beginning, except for theme-responsive.css
stream.queue(
gulp.src('src/vendor/theme/**/*.css', '!src/vendor/theme/theme-responsive.css')
);
//Now I would like to add the theme-responsive.css file
stream.queue(
gulp.src('src/vendor/theme/theme-responsive.css')
);
return stream.done()
.pipe(concat("app.css"))
.pipe(gulp.dest('public/css/'))
});
К сожалению, когда я сейчас запускаю этот скрипт, bootstrap.css и другие файлы, которые он должен игнорировать, добавляются несколько раз. Как игнорировать файл с помощью gulp?