I have a gulp watch task that uses gulp-sass
to convert SASS to CSS. For development, separated CSS files are all I want.
For release, I have a min
tasks that uses gulp-cssmin
and concat
to bundle and minify the CSS. However, the min
task doesn't deal with the SASS files. It assumes they have already been converted to CSS.
Is this a valid assumption? What if an automated build gets the latest source (which does not have .scss files) and runs min
? Is there a race condition here as to whether the watch task will run in time for min
to pick up the SASS files?
If your min
task is also watching the SASS files, your assumption is not necessarily valid. By default, all the tasks will run at the same time. You can however define dependencies in your task, so that a task does not start until another task is finished. This could solve your problem. The documentation about dependencies can be found here.
There are also two other solutions:
min
task.min
task at the end of the task that compiles the SASS.