I build the front desk using gulp, jade, and compass.
--jade
│ │ _ --_partial
│ │ _ --_banners.jade
│ │ _ --_breadcrumb.jade
│ │ _ --_fixed_header.jade
│ │ _ -- --_footer.jade
│ │ _ --_head.jade
│ │ _ --_header.jade
│ │ _ --_lists.jade
│ │ _ --_maps.jade
│ │ _ --_recommend.jade
│ │ _ --_second_banner.jade
│ │ _ --_sidebar.jade
│ │ _ --_top_banner.jade
│ │ _ --_top_search.jade
│ │ --_tweets.jade
│ in -- index.jade
I would like to output only index.html
, but the _partial
folder will also be output.
The following is gulpfile.js.
'use strict';
var gulp=require('gulp');
varcompass=require('gulp-compass');
var jade=require('gulp-jade');
varplumber = require('gulp-plumber');
gulp.task('jade', function(){
gulp.src('./app/jade/**/*.jade')
.pipe(plumber())
.pipe(jade({
pretty —true
}))
.pipe(gulp.dest('./dist/html'));
});
gulp.task('compass', function(){
gulp.src('compass', function(){
gulp.src('.app/sass/**/*.scss')
.pipe(plumber())
.pipe(compass({
config_file: 'config.rb',
comments: false,
css: './dist/css/',
pass: './app/sass/'
}));
});
});
gulp.task('watch', ['jade', 'compass', function(){
gulp.watch('./app/jade/**/*.jade', ['jade']);
gulp.watch('./app/sass/**/*.scss', ['compass']);
});
gulp.task('default', ['jade', 'compass']);
I would appreciate it if someone could let me know.
Thank you for your cooperation.
In gulp.src
, specify the path you do not want to retrieve using !
.
var gulp=require("gulp");
gulp.task("build", function(){
gulp.src(["source/**/*", "!source/_**/*", "!source/**/_*")
.pipe(gulp.dest("build"));
});
If you run gulp build
in the above state:
/
+ node_modules/
+ source/
| +_partial/
| | +_partial.html
| | + partial.html
| |
| +_index.html
| + index.html
|
+ build/
| + index.html
|
+ gulpfile.js
+ package.json
The gulp.src
argument is processed by glob, so if you want to exclude files with _
across the head, you can simply write:
gulp.task('jade', function(){
gulp.src('./app/jade/**/!(_)*.jade')
.pipe(plumber())
.pipe(jade({
pretty —true
}))
.pipe(gulp.dest('./dist/html'));
});
© 2024 OneMinuteCode. All rights reserved.