gulp过滤javascript文件而不是css文件

时间:2015-07-04 23:08:47

标签: gulp gulp-concat

我是gulp的新手。我正在尝试使用gulp创建一个vendor.css文件和vendor.js文件。

vendor.css应该是

Uint32 colorKey = SDL_MapRGB( formattedSurface->format, 0, 0xFF, 0xFF );
Uint32 transparent = SDL_MapRGBA( formattedSurface->format, 0XFF, 0XFF, 0XFF, 0xFF );

vendor.js应为

 -bootstrap.css

gulpfile.js

 -jquery.js
 -bootstrap.js
 -angular.js
 -angular-ui-router.js

当我运行gulp serve时,它会毫无错误地执行。但我最终得到了

// Include Gulp
var gulp = require('gulp');
// Include plugins
var plugins = require("gulp-load-plugins")({
    pattern: ['gulp-*', 'gulp.*'],
    replaceString: /\bgulp[\-.]/
});
// Define default destination folder
var dest = 'public';

gulp.task('vendorjs', function(){
    var filterJS = plugins.filter('**/*.js');
    return gulp.src('./bower.json')
        .pipe(plugins.mainBowerFiles( ))
        .pipe(filterJS)
        .pipe(plugins.concat('vendor.js'))
        .pipe(plugins.uglify())
        .pipe(filterJS.restore())
        .pipe(gulp.dest(dest+"/vendor/js/"));
});
gulp.task('vendorcss', function(){
    var filterCSS = plugins.filter('**/*.css');
    return gulp.src('./bower.json')
        .pipe(plugins.mainBowerFiles( ))
        .pipe(filterCSS)
        .pipe(plugins.concat('vendor.css'))
        .pipe(plugins.uglify())
        .pipe(filterCSS.restore())
        .pipe(gulp.dest(dest+"/vendor/css/"));
});


gulp.task('default', function() {
  // place code for your default task here
});

gulp.task('serve', ['vendorcss','vendorjs'], function () {

});
  1. 为什么我的css文件丢失了。为什么我得到的文件更少。
  2. 我的输出应该是

    public/vendor/css/angular/angular.js 
    
    public/vendor/css/angular-ui-router/release/angular-ui-router.js
    
    public/vendor/css/bootstrap/dist/js/bootstrap.js
    
    public/vendor/css/bootstrap/less/bootstrap.less
    
    public/vendor/css/jquery/dist/jquery.js
    
    public/vendor/js/vendor.js
    
    public/vendor/js/bootstrap/less/bootstrap.less
    
    1. 如何使用我的html
    2. 映射vendor.js和vendor.css

0 个答案:

没有答案