uswds / uswds-compile

Simple Gulp 4 functions for copying USWDS static assets and transforming USWDS Sass into browser-readable CSS.
Other
21 stars 12 forks source link

USWDS-Compile - Feature: Flag to stop on errors #62

Open patrickcate opened 1 year ago

patrickcate commented 1 year ago

Is your feature request related to a problem? Please describe.

With #5334 I ran into an issue with Sass not compiling. I would have expected the Gulp task to fail, but it didn't.

I run the Sass compilation within a CI/CD process but because the gulp task did not error, it allowed the update to pass.

Is there a way emit an error if the Sass compiling, or other tasks, fail?

Not sure if this is a feature request or just a support/documentation request.

Describe the solution you'd like

A way to catch errors in the Gulp tasks so they can be acted upon.

Describe alternatives you've considered

Writing a custom Gulp Sass compiling task, but that adds a maintenance burden that my client may not be comfortable taking on. It also negates one of the main reasons for using this project for our build process.

Additional context

From what I can tell the buildSass task only emits an end event, not an error.

function handleError(error) {
  log(error.message);
  return this.emit("end");
}

Code of Conduct

mejiaj commented 1 year ago

@patrickcate handling errors without crashing process was an intentional decision at the start. During active development it can be frustrating to have the entire process stop on a failure. Even one as small as missing semi-colon.

Is your feature request the option to crash or continue when handling errors?

patrickcate commented 1 year ago

During active development it can be frustrating to have the entire process stop on a failure. Even one as small as missing semi-colon.

I can agree this is helpful during development when using the watch task, but I would suggest the compile task should fail on errors. Otherwise there is no reliable way (I'm aware of) to know when there is a problem compiling.

Is your feature request the option to crash or continue when handling errors?

I guess my feature request is to fail on errors when using the compile task, or at least provide that as an option.