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

Minify styles #2387

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Minify styles #2387

merged 2 commits into from
Oct 17, 2024

Conversation

adekbadek
Copy link
Member

All Submissions:

Changes proposed in this Pull Request:

Adds CSS minification to the created stylesheets.

Also fixes a warning triggered by Sass about rule nesting. Nested rules should be placed after other rules.

How to test the changes in this Pull Request:

  1. Run npm run build and observe the <theme-slug>/style.css files are minified
  2. Smoke-check the front-end to see if it looks as expected

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@adekbadek adekbadek added the [Status] Needs Review The issue or pull request needs to be reviewed label Oct 11, 2024
@adekbadek adekbadek requested a review from a team as a code owner October 11, 2024 10:21
Copy link
Contributor

@dkoo dkoo left a comment

Choose a reason for hiding this comment

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

This is working as described, but while testing I noticed a warning in the SASS CLI output:

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

More info: https://sass-lang.com/d/legacy-js-api

Looking at the migration documentation and the replacement compile function, it seems that Dart SASS now supports compressed/minified output natively. Would it be preferable to migrate to the new API and avoid having to add the cssnano dependency?

@adekbadek
Copy link
Member Author

@dkoo – I've tried upgrading to compile, but ran into errors. I've decided that since it works as it is, it's not worth investing more time into.

@dkoo
Copy link
Contributor

dkoo commented Oct 14, 2024

Ok, we can re-cross that bridge when sass introduces a new major version.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Oct 14, 2024
@dkoo dkoo merged commit 069515a into trunk Oct 17, 2024
6 checks passed
@dkoo dkoo deleted the minify-styles branch October 17, 2024 16:06
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.1.1-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants