iamstarkov / gulp-bem-stub

Example BEM project building with gulp-bem
http://matmuchrapna.github.io/gulp-bem-stub/
26 stars 4 forks source link

need clean api to properly finishing build task #6

Closed iamstarkov closed 10 years ago

floatdrop commented 10 years ago

Could you clarify this issue a little?

iamstarkov commented 10 years ago

If we need to exec some task exactly after build task (e.g publish to gh-pages), then build task should properly finish itself

floatdrop commented 10 years ago

Do you talking about run-sequence?

iamstarkov commented 10 years ago

nope.

iamstarkov commented 10 years ago

can we do something like this?

var deps;

gulp.task('deps', function (done) {
    var tree = bem.objects(levels).pipe(bem.tree());
    deps = tree.deps('pages/index/page');
    if (argv.debug) { deps.pipe(debug()); }
    done();
});

gulp.task('css', ['deps'], function () {
    return deps.src('{bem}.css')
        .pipe(concat('index.css'))
        .pipe(gulp.dest('./dist'));
});

gulp.task('html', ['deps'], function () {
    return deps.src('{bem}.bh.js')
        .pipe(bh(require('./pages/index/page/page.bemjson.js'), 'index.html'))
        .pipe(gulp.dest('./dist'));
});

gulp.task('build', ['clean', 'html', 'css']);
iamstarkov commented 10 years ago

because after this we can safely create

gulp.task('gh', ['build'], function() {/* buildbranch*/});
floatdrop commented 10 years ago

Yep, should work.

iamstarkov commented 10 years ago
[01:52:12] Using gulpfile ~/Documents/Яндекс.Диск/projects/gulp-bem-stub/gulpfile.js
[01:52:12] Starting 'clean'...
[01:52:12] Starting 'deps'...
[01:52:12] Finished 'deps' after 18 ms
[01:52:12] Starting 'html'...
[01:52:12] Starting 'css'...
[01:52:12] Finished 'clean' after 44 ms
[01:52:12] Finished 'html' after 66 ms
[01:52:12] Finished 'css' after 75 ms
[01:52:12] Starting 'build'...
[01:52:12] Finished 'build' after 8.11 μs

tasks for css and html running asynchronous and it's awesome