charlottefasad.blogg.se

Pug documentation
Pug documentation











pug documentation

I later came up with a solution: write a custom pug lint reporter function for the Gulp task. Since the option in gulp-pug-linter for using a custom error reporter was the same option used to configure errors to trigger the task to fail upon lint errors, it felt like I wouldn't be able to get my prettified output after all.

pug documentation

The problem I faced with gulp-pug-linter was that I wanted to use a custom error reporter (puglint-stylish) but still have the Gulp lint task use proper exit codes. I then set out to make these 2 tools work together. Enter puglint-stylish, an error reporter that would give me the nicely formatted output I was looking for. Then I discovered that I wouldn't be able to get the prettified error formatting using that Gulp plugin alone. I found gulp-pug-linter, which uses the pug-lint CLI. It's just way better having errors printed out in an easy-to-read way! Having previously set up Sass file linting with gulp-stylelint, which uses stylelint, I was already used to its prettified error reporting and wanted the same for Pug linting.

Pug documentation code#

My goal was to have prettified lint output for any lint errors along with proper exit codes, meaning an exit code of zero for clean runs and non-zero for runs where errors were found. As a result, linting is a great process to kick off as part of builds and any automated continuous integration or deployment pipeline. First of all, why linting? It's a great way to be able to detect any formatting errors or other code issues that may trigger bugs when working on new features. I recently set up Pug file linting for a Node.js/Express project at work that was already using Gulp. See the gulp-pug-linter documentation for more details.

pug documentation

The Pug file linting tool mentioned below, pug-linter, now supports a “fail on exit” mode and custom reporting options, which makes the custom Gulp lint reporter strategy below unneeded.













Pug documentation