Gulp文件没有将较少的文件编译为css

时间:2016-06-14 08:42:13

标签: javascript gulp

我有一个gulp文件,当我运行它时,只有JavaScript文件得到编译,较少的文件没有被编译,我似乎无法理解为什么会发生这种情况。

这是我的gulp文件:

'use strict';

var path = require('path'); 
var gulp = require('gulp'); 
var concat = require('gulp-concat'); 
var sourcemaps = require('gulp-sourcemaps'); 
var less = require('gulp-less'); 
var watch = require('gulp-watch'); 
var jshint = require('gulp-jshint'); 
var jscs = require('gulp-jscs'); 
var livereload = require('gulp-livereload');

var jsFiles = ['*.js', 'src/**/*.js'];

// js hints 
gulp.task('hints', function(){
    return gulp.src(jsFiles)
        .pipe(jshint())
        .pipe(jshint.reporter('jshint-stylish', {
            verbose: true
        }))
        .pipe(jscs()); });

// less 
gulp.task('less', function () {
    return gulp.src('./public/src/less/main.less')
        .pipe(less({ paths: [path.join(__dirname, 'less', 'includes')] }))
        .pipe(gulp.dest('./public/src/less/css')); });

// concat 
gulp.task('concat', ['concat:css', 'concat:js']); gulp.task('concat:css', function() {
    return gulp.src([
            'public/lib/bower_components/bootstrap/dist/css/bootstrap.min.css',
            'public/lib/bower_components/swiper/dist/css/swiper.min.css',
            'public/lib/bower_components/font-awesome/css/font-awesome.min.css',
            'public/src/less/css/main.css'
        ])
        .pipe(concat('styles.css'))
        .pipe(gulp.dest('./public/build/')); }); gulp.task('concat:js', function() {
    return gulp.src([
            'public/lib/bower_components/jquery/dist/jquery.min.js',
            'public/lib/bower_components/bootstrap/dist/js/bootstrap.min.js',
            'public/lib/bower_components/swiper/dist/js/swiper.min.js',
            'public/lib/bower_components/jquery.scrollTo/jquery.scrollTo.min.js',
            'public/lib/bower_components/jquery.localScroll/jquery.localScroll.min.js',
            'public/lib/bower_components/jquery-waypoints/lib/jquery.waypoints.min.js',
            'public/lib/bower_components/gsap/src/uncompressed/TweenMax.js',
            'public/lib/bower_components/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js',
            'public/lib/bower_components/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js',
            'public/lib/bower_components/scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js',
            'public/src/js/init.js',
            'public/src/js/utils.js',
            'public/src/js/main.js'
        ])
        .pipe(concat('scripts.js'))
        .pipe(gulp.dest('./public/build/')); });

// watch 
gulp.task('watch', ['watch:css', 'watch:js']); 
gulp.task('watch:css', function () {    
 gulp.watch('public/src/less/*.less', ['less', 'concat:css']); 
}); 
gulp.task('watch:js', function () {    
 gulp.watch('public/src/js/*.js', ['concat:js', 'hints']); 
});

gulp.task('build', [ 'less', 'concat']); 
gulp.task('development', [ 'less', 'concat', 'watch']);

当我运行gulp开发时,css和js文件会在build文件夹下创建,但因为较少的文件没有编译成css,build文件夹下的css文件没有我的样式。

有人知道如何解决这个问题吗?

谢谢

0 个答案:

没有答案