September 14, 2015

Gulp – catch and log less errors

To work efficiently its indispensable to get detailed error messages. If you simply pipe the gulp-less task to your stream you will receive a error message – but your whole gulp task will crash.

what we get:

what we actually want:
gulp catch less errors


Add Error Handler to Gulp

In order to display the errors and prevent your whole gulp task from crashing you need to add an error handler function. Since we want it colorized we use gulp-util ( npm install gulp-util –save-dev ).

Next step is to pipe the onError-function to our stream (line 6) :


This works not only for less but for all streams. So you can also log your linting errors or stuff like that, even with custom colors to classify faster wether its an js/less/… error

Related Posts

Admin Admin
Developer at thecodecampus </>

Leave a Reply

Add code to your comment in Markdown syntax.
Like this:
`inline example`

code block

Your email address will not be published.