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

Migrate to Dart Sass from LibSass #3908

Merged
merged 6 commits into from
Jan 17, 2024
Merged

Migrate to Dart Sass from LibSass #3908

merged 6 commits into from
Jan 17, 2024

Conversation

jon-kirwan
Copy link
Contributor

@jon-kirwan jon-kirwan commented Jan 3, 2024

What

Migrate to Dart Sass from LibSass.

Why

Visual Changes

None.

How can I test these changes?

  • run yarn jasmine:prepare (or run bundle exec rake app:assets:clobber app:assets:precompile)
  • what should happen? The Sass files should be compiled. Keep an eye on the command line for warnings indicating the compilation process using Dart Sass
Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(300%, 4) or calc(300% / 4)
More info and automated migrator: https://sass-lang.com/d/slash-div
   │
26 │   three-quarters: (300% / 4),
   │                    ^^^^^^^^
   ...
  • the /builds folder: app/assets/builds should now be populated with CSS files. Note, the
  • subsequently, all assets ought to be generated successfully within the /public directory
  • no test failures to indicate the correct number of stylesheets are generated
  • deploy to Integration. You'll notice that in the 'build and publish image' task, the steps taken resemble those mentioned earlier, dartsass-rails is bundled and any Dart Sass warnings encountered during the compilation process are reported)
  • inspect several pages, e.g. homepage, UK bank holidays, register to vote, contact DVLA to ensure the absence of errors.

Anything else

Once the PR gets the green light, any temporary commits and references to local gems e.g. gem "govuk_publishing_components", path: "../govuk_publishing_components" will be removed.

See:

@jon-kirwan jon-kirwan changed the title Migrate to dart sass Migrate to Dart Sass from LibSass Jan 3, 2024
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-3908 January 3, 2024 10:36 Inactive
@jon-kirwan jon-kirwan force-pushed the migrate-to-dart-sass branch from 68b3671 to 28833a4 Compare January 3, 2024 12:05
@govuk-ci govuk-ci had a problem deploying to govuk-frontend-app-pr-3908 January 3, 2024 12:05 Failure
@jon-kirwan jon-kirwan force-pushed the migrate-to-dart-sass branch from 28833a4 to 0f989df Compare January 4, 2024 09:35
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-3908 January 4, 2024 09:36 Inactive
@jon-kirwan jon-kirwan marked this pull request as ready for review January 4, 2024 14:47
@jon-kirwan jon-kirwan force-pushed the migrate-to-dart-sass branch from 0f989df to 338d739 Compare January 12, 2024 10:09
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-3908 January 12, 2024 10:10 Inactive
Copy link
Contributor

@1pretz1 1pretz1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @jon-kirwan. I've tested locally using live data and integration and everything builds correctly / app runs as normal. Looks like the linter has failed, however it is an easy fix.

Also noted the deprecation warnings (Using / for division outside of calc()), however I understand that we cant fix them without breaking the LibSass implementation in the components Gem. Hopefully we (GOV.UK) can migrate to Dart Sass fully before 2.0 is released and squash the warnings.

jon-kirwan and others added 6 commits January 17, 2024 10:39
Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
- Create `dartsass.builds` initializer and add all Sass files to be compiled. See https://github.com/rails/dartsass-rails#configuring-builds
- Create .keep
- Update manifest file to use /builds directory
- Ignore /builds

Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
Also, turn digests off in development

Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
Co-Authored-By: Martin Jones <28779939+MartinJJones@users.noreply.github.com>
@jon-kirwan jon-kirwan force-pushed the migrate-to-dart-sass branch from 338d739 to d56a877 Compare January 17, 2024 10:42
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-3908 January 17, 2024 10:43 Inactive
@jon-kirwan
Copy link
Contributor Author

Nice work @jon-kirwan. I've tested locally using live data and integration and everything builds correctly / app runs as normal. Looks like the linter has failed, however it is an easy fix.

Also noted the deprecation warnings (Using / for division outside of calc()), however I understand that we cant fix them without breaking the LibSass implementation in the components Gem. Hopefully we (GOV.UK) can migrate to Dart Sass fully before 2.0 is released and squash the warnings.

Thanks @1pretz1. I've resolved the linter error, and all CI checks are now passing.

Currently, the linter warnings are from GOV.UK Publishing Components, and I've opened an issue to investigate. We also had warnings from the Design System, but have silenced those with this change:

Rails.application.config.dartsass.build_options << " --quiet-deps"

@jon-kirwan jon-kirwan merged commit 66874f1 into main Jan 17, 2024
13 checks passed
@jon-kirwan jon-kirwan deleted the migrate-to-dart-sass branch January 17, 2024 10:58
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.

3 participants