Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sass errors clearer to the user #990

Merged
merged 2 commits into from
Mar 19, 2021
Merged

Make sass errors clearer to the user #990

merged 2 commits into from
Mar 19, 2021

Conversation

joelanman
Copy link
Contributor

@joelanman joelanman commented Feb 22, 2021

to fix issue #295

  • changes the Gulp log level to be quieter so errors stand out
  • makes a blank application.css file if there are sass errors so the site looks broken to the user (simply removing the css file does not work with browserSync)
  • if the user fixes the sass error, the site will automatically reload, as opposed to Make sass errors stop Gulp to make them clearer #977 which crashes and you have to restart the kit after fixing the sass

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-prototype-kit-pr-990 February 22, 2021 16:35 Inactive
@joelanman joelanman temporarily deployed to govuk-prototype-kit-pr-990 February 22, 2021 16:37 Inactive
@joelanman joelanman temporarily deployed to govuk-prototype-kit-pr-990 February 22, 2021 16:38 Inactive
@joelanman
Copy link
Contributor Author

joelanman commented Feb 22, 2021

the output now looks like this:

GDS3941:govuk-prototype-kit joelanman$ npm start

> govuk-prototype-kit@9.12.1 start
> node start.js


 app/assets/sass/application.scss
Error: @import directive requires a url or quoted path
        on line 19 of app/assets/sass/application.scss
        from line 3 of app/assets/sass/application-ie8.scss
>> @import bananas;

   ^
 

[16:42:21] [nodemon] 2.0.7
[16:42:21] [nodemon] to restart at any time, enter `rs`
[16:42:21] [nodemon] watching path(s): .env **/*.js **/*.json
[16:42:21] [nodemon] watching extensions: js,mjs,json
[16:42:21] [nodemon] starting `node listen-on-port.js`

GOV.UK Prototype Kit v9.12.1

NOTICE: the kit is for building prototypes, do not use it for production services.

Listening on port 3000   url: http://localhost:3000

@vanitabarrett vanitabarrett linked an issue Feb 26, 2021 that may be closed by this pull request
@vanitabarrett
Copy link
Contributor

Thanks for looking into this @joelanman ! This approach makes the most sense to me. It gives the user a clue that something has gone wrong with the sass even if they don't spot the error message first. It does feel a bit hacky that we have to do this in the first place, but I can't think of an alternative... I'd be interested in seeing what @36degrees and @hannalaakso think.

@hannalaakso
Copy link
Member

Seems okay to me too. And we're limiting the impact of the changes to a specific action (when Sass compilation throws an error). Do we know if anyone from the community has had a chance to review this? It feels like the sort of thing that it would be good to run past a user to see if it makes sense to them.

@joelanman
Copy link
Contributor Author

@hannalaakso great point, have now tested with 3 users and the fact the site looks broken when a sass error occurs is very clear to all. 1 participant didn't realise there was an error in the terminal, but I think we can look at adding guidance in the tutorial to check the terminal for errors in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sass compilation errors more obvious
4 participants