2015-09-26 2 views
0

У меня есть каталог, в который я помещаю свои угловые частицы. Содержит следующие файлы:Gulp globbing не находит все файлы

➜ partials: pwd 
/home/dev/webapp/ui/public/partials 
➜ partials: ls 
connect-local.html landing.html login.html profile.html signup.html 

И я бегу глотка к Concat и преуменьшать их в шаблон Cache углам главного. У меня есть это в моей gulpfile

//gulpfile.js 

... 

.pipe(plugins.usemin({ 
      templateCache: [ 
       gulp.src(['public/partials/*.html']), 
       plugins.debug(), 
       plugins.angularTemplatecache({ 
        module: 'myApp', 
        root: 'partials/' 
       }), 
       'concat', 
       plugins.rev() 
      ] 
     }))) 
     .pipe(gulp.dest('dist/')); 

Однако gulp.src только собирание некоторые из моих файлов, как показано Глоток-отладки:

[15:46:53] Starting 'build'... 
[15:46:55] gulp-debug: ~/what/ui/public/partials/connect-local.html 
[15:46:55] gulp-debug: ~/what/ui/public/partials/landing.html 
[15:46:55] gulp-debug: ~/what/ui/public/partials/login.html 
[15:46:55] gulp-debug: ~/what/ui/public/assets/javascript/templates.js 
[15:46:55] gulp-debug: 4 items 
[15:46:55] Finished 'build' after 1.29 s 

там что-то мне не хватает? Я успешно использовал этот код. Есть ли обходной путь? Его любопытное парализует мое приложение атм

+0

Какой nodejs пакет вы требуя, чтобы сделать usemin? – CDF

+0

последние https://github.com/zont/gulp-usemin – Darcys22

ответ

1

Вот мой Глоток сборки, так что вы можете сравнить, чтобы увидеть, если это поможет найти то, что вам не хватает:

'use strict'; 

var gulp = require('gulp'); 

var $ = require('gulp-load-plugins')({ 
    pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del'] 
}); 

module.exports = function(options) { 
    gulp.task('partials', function() { 
    return gulp.src([ 
     options.src + '/{app,components}/**/*.html', 
     options.tmp + '/serve/{app,components}/**/*.html' 
    ]) 
     .pipe($.minifyHtml({ 
     empty: true, 
     spare: true, 
     quotes: true 
     })) 
     .pipe($.angularTemplatecache('templateCacheHtml.js', { 
     module: 'myApp', 
     root: '/' 
     })) 
     .pipe(gulp.dest(options.tmp + '/partials/')); 
    }); 

    gulp.task('html', ['inject', 'partials'], function() { 
    var partialsInjectFile = gulp.src(options.tmp + '/partials/templateCacheHtml.js', { read: false }); 
    var partialsInjectOptions = { 
     starttag: '<!-- inject:partials -->', 
     ignorePath: options.tmp + '/partials', 
     addRootSlash: false 
    }; 

    var htmlFilter = $.filter('*.html'); 
    var jsFilter = $.filter('**/*.js'); 
    var cssFilter = $.filter('**/*.css'); 
    var assets; 

    return gulp.src(options.tmp + '/serve/*.html') 
     .pipe($.inject(partialsInjectFile, partialsInjectOptions)) 
     .pipe(assets = $.useref.assets()) 
     .pipe($.rev()) 
     .pipe(jsFilter) 
     .pipe($.ngAnnotate()) 
     .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', options.errorHandler('Uglify')) 
     .pipe(jsFilter.restore()) 
     .pipe(cssFilter) 
     .pipe($.replace('../../bower_components/bootstrap/fonts/', '../fonts/')) 
     .pipe($.csso()) 
     .pipe(cssFilter.restore()) 
     .pipe(assets.restore()) 
     .pipe($.useref()) 
     .pipe($.revReplace()) 
     .pipe(htmlFilter) 
     .pipe($.minifyHtml({ 
     empty: true, 
     spare: true, 
     quotes: true, 
     conditionals: true 
     })) 
     .pipe(htmlFilter.restore()) 
     .pipe(gulp.dest(options.dist + '/')) 
     .pipe($.size({ title: options.dist + '/', showFiles: true })); 
    }); 

    // Only applies for fonts from bower dependencies 
    // Custom fonts are handled by the "other" task 
    gulp.task('fonts', function() { 
    return gulp.src($.mainBowerFiles()) 
     .pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}')) 
     .pipe($.flatten()) 
     .pipe(gulp.dest(options.dist + '/fonts/')); 
    }); 

    gulp.task('other', function() { 
    return gulp.src([ 
     options.src + '/**/*.*', 
     '!' + options.src + '/**/*.{html,css,js,less}' 
    ]) 
     .pipe(gulp.dest(options.dist + '/')); 
    }); 

    gulp.task('clean', function (done) { 
    $.del([options.dist + '/', options.tmp + '/'], done); 
    }); 

    gulp.task('build', ['html', 'fonts', 'other']); 

    gulp.task('build:clean',['clean'],function(){ 
    gulp.start('build'); 
    }); 
}; 
Смежные вопросы