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

Improve our Sass workflow to check for compilation of variables and functions with LibSass and Ruby Sass #4783

Open
1 of 2 tasks
romaricpascal opened this issue Feb 20, 2024 · 3 comments · Fixed by #4784
Open
1 of 2 tasks

Comments

@romaricpascal
Copy link
Member

romaricpascal commented Feb 20, 2024

What

Improve our Sass workflow to verify that Libsass and Ruby Sass correctly transform all the Sass variables and functions in our code.

Why

Our Sass code can still be imported with Libsass and Ruby Sass (as we've yet to move to Sass module system). However these older versions do not transform some newer syntaxes supported by dart Sass, outputting invalid CSS.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Our Sass workflow checks for the presence of Sass variables in the built ouput
  • Our Sass workflow checks for the presence of function calls starting with govuk- in the built output.
@romaricpascal romaricpascal added awaiting triage Needs triaging by team sass / css assurance tooling and removed awaiting triage Needs triaging by team labels Feb 20, 2024
@romaricpascal
Copy link
Member Author

A possible way to achieve this could be to run a custom Stylelint plugin with two rules:

  • one failing at the presence of a Sass variable
  • one failing at the presence of a function starting with govuk- (as there may be legitimate calls to CSS functions and we don't want to keep an eye on all the functions in CSS as of today or introduced in the future).

@romaricpascal
Copy link
Member Author

#4784 nicely finds the Sass variables using grep. If we can use grep to match the function calls as well, that would be ace. This may require us to use the -E or -P flag for more complex regexp.

@colinrotherham
Copy link
Contributor

Bit late now, but this would do it:

! grep --regexp "\$govuk-" --regexp "govuk\-\([a-z0-9-]\+\)(" .tmp/all.css

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

Successfully merging a pull request may close this issue.

2 participants