S
S
stanlee2015-09-15 01:26:42
css
stanlee, 2015-09-15 01:26:42

How to use gulp.spritesmith generated styl file in your project?

There is a project with its own styl files.
There is a task for spritesmith to generate a sprite.
Everything is done in this order

gulp.task('build', ['frontend_sprite', 'frontend_img', 'frontend_css', 'union_css', 'frontend_js']);

frontend_sprite generates a sprite and styl file
frontend_img throws images from the repository to the right place
frontend_css generates styl files from the repository + sprite styl file
union_css combines the collected css from styl files + css from the head external libraries loaded via bower
The problem is that the first time you run gulp build is not is collected all together, only when you restart.
As I understand it, the file from the frontend_css task is not visible, but how to do it in 1 run?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Ermolaev, 2015-09-24
@iusfof

stackoverflow.com/a/26390567/3881371
You need to tell the task to wait for another task to complete, like so:

gulp.task('frontend_sprite', function(){
  // тело функции
});

gulp.task('frontend_img', ['frontend_sprite'], function(){ // будет ждать пока выполнится 'frontend_sprite' перед запуском
  // тело функции
});

gulp.task('frontend_css', ['frontend_sprite'], function(){ // будет ждать пока выполнится 'frontend_sprite' перед запуском
  // тело функции
});

gulp.task('frontend_css', ['union_css'], function(){ // будет ждать пока выполнится 'union_css' перед запуском
  // тело функции
});

gulp.task('frontend_js', function(){
  // тело функции
});

gulp.task('build', ['frontend_sprite', 'frontend_img', 'frontend_css', 'union_css', 'frontend_js']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question