-
Notifications
You must be signed in to change notification settings - Fork 324
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
Rename all
files to index
for our Sass entrypoints
#4955
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use `index` as the entrypoint for each layer as it: - matches how we’re structuring the Sass for components - allows users to omit ‘index’ from the filename where their Sass compiler supports index files (Dart Sass, LibSass 3.6.0 or higher, or Ruby Sass 3.6.0 or higher [1]) - is a small stepping stone towards moving to the Sass module system [2] Keep the existing `all` files as aliases, but add deprecation warnings when importing via them so we can remove those files in the next major release. [1]: https://sass-lang.com/documentation/at-rules/import/#index-files [2]: https://tannerdolby.com/writing/using-index-files-in-sass/
36degrees
changed the title
Rename ‘all’ files to ‘index’ for our Sass entrypoints
Rename Apr 24, 2024
all
files to index
for our Sass entrypoints
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 85e7fe4 |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/_base.scss b/packages/govuk-frontend/dist/govuk/_base.scss
index 58c825543..adc899c85 100644
--- a/packages/govuk-frontend/dist/govuk/_base.scss
+++ b/packages/govuk-frontend/dist/govuk/_base.scss
@@ -1,5 +1,5 @@
-@import "settings/all";
-@import "tools/all";
-@import "helpers/all";
+@import "settings/index";
+@import "tools/index";
+@import "helpers/index";
/*# sourceMappingURL=_base.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/all.scss b/packages/govuk-frontend/dist/govuk/all.scss
index f3125cbb0..d906d5093 100644
--- a/packages/govuk-frontend/dist/govuk/all.scss
+++ b/packages/govuk-frontend/dist/govuk/all.scss
@@ -1,11 +1,11 @@
@import "base";
-@import "core/all";
-@import "objects/all";
+@import "core/index";
+@import "objects/index";
-@import "components/all";
+@import "components/index";
-@import "utilities/all";
-@import "overrides/all";
+@import "utilities/index";
+@import "overrides/index";
/*# sourceMappingURL=all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/components/_all.scss b/packages/govuk-frontend/dist/govuk/components/_all.scss
index e0f702951..b8fd480b8 100644
--- a/packages/govuk-frontend/dist/govuk/components/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/components/_all.scss
@@ -1,39 +1,10 @@
-@import "../base";
+@import "../settings/warnings";
+@import "index";
-@import "accordion/index";
-@import "back-link/index";
-@import "breadcrumbs/index";
-@import "button/index";
-@import "character-count/index";
-@import "checkboxes/index";
-@import "cookie-banner/index";
-@import "date-input/index";
-@import "details/index";
-@import "error-message/index";
-@import "error-summary/index";
-@import "exit-this-page/index";
-@import "fieldset/index";
-@import "file-upload/index";
-@import "footer/index";
-@import "header/index";
-@import "hint/index";
-@import "input/index";
-@import "inset-text/index";
-@import "label/index";
-@import "notification-banner/index";
-@import "pagination/index";
-@import "panel/index";
-@import "password-input/index";
-@import "phase-banner/index";
-@import "radios/index";
-@import "select/index";
-@import "skip-link/index";
-@import "summary-list/index";
-@import "table/index";
-@import "tabs/index";
-@import "tag/index";
-@import "task-list/index";
-@import "textarea/index";
-@import "warning-text/index";
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/components/all' is deprecated. Update your import statement to import 'govuk/components/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/components/_index.scss b/packages/govuk-frontend/dist/govuk/components/_index.scss
new file mode 100644
index 000000000..c0c34dca3
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/_index.scss
@@ -0,0 +1,39 @@
+@import "../base";
+
+@import "accordion/index";
+@import "back-link/index";
+@import "breadcrumbs/index";
+@import "button/index";
+@import "character-count/index";
+@import "checkboxes/index";
+@import "cookie-banner/index";
+@import "date-input/index";
+@import "details/index";
+@import "error-message/index";
+@import "error-summary/index";
+@import "exit-this-page/index";
+@import "fieldset/index";
+@import "file-upload/index";
+@import "footer/index";
+@import "header/index";
+@import "hint/index";
+@import "input/index";
+@import "inset-text/index";
+@import "label/index";
+@import "notification-banner/index";
+@import "pagination/index";
+@import "panel/index";
+@import "password-input/index";
+@import "phase-banner/index";
+@import "radios/index";
+@import "select/index";
+@import "skip-link/index";
+@import "summary-list/index";
+@import "table/index";
+@import "tabs/index";
+@import "tag/index";
+@import "task-list/index";
+@import "textarea/index";
+@import "warning-text/index";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/core/_all.scss b/packages/govuk-frontend/dist/govuk/core/_all.scss
index a9c87c554..919b9ac03 100644
--- a/packages/govuk-frontend/dist/govuk/core/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/core/_all.scss
@@ -1,8 +1,10 @@
-@import "govuk-frontend-properties";
-@import "links";
-@import "lists";
-@import "typography";
-@import "section-break";
-@import "global-styles";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/core/all' is deprecated. Update your import statement to import 'govuk/core/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/core/_index.scss b/packages/govuk-frontend/dist/govuk/core/_index.scss
new file mode 100644
index 000000000..b0b59758e
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/core/_index.scss
@@ -0,0 +1,8 @@
+@import "govuk-frontend-properties";
+@import "links";
+@import "lists";
+@import "typography";
+@import "section-break";
+@import "global-styles";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/helpers/_all.scss b/packages/govuk-frontend/dist/govuk/helpers/_all.scss
index d79faf6ac..b6850afda 100644
--- a/packages/govuk-frontend/dist/govuk/helpers/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/helpers/_all.scss
@@ -1,14 +1,10 @@
-@import "clearfix";
-@import "colour";
-@import "device-pixels";
-@import "focused";
-@import "font-faces";
-@import "grid";
-@import "links";
-@import "media-queries";
-@import "shape-arrow";
-@import "spacing";
-@import "typography";
-@import "visually-hidden";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/helpers/all' is deprecated. Update your import statement to import 'govuk/helpers/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/helpers/_index.scss b/packages/govuk-frontend/dist/govuk/helpers/_index.scss
new file mode 100644
index 000000000..7a039bdd1
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/helpers/_index.scss
@@ -0,0 +1,14 @@
+@import "clearfix";
+@import "colour";
+@import "device-pixels";
+@import "focused";
+@import "font-faces";
+@import "grid";
+@import "links";
+@import "media-queries";
+@import "shape-arrow";
+@import "spacing";
+@import "typography";
+@import "visually-hidden";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/index.scss b/packages/govuk-frontend/dist/govuk/index.scss
new file mode 100644
index 000000000..393a85f39
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/index.scss
@@ -0,0 +1,11 @@
+@import "base";
+
+@import "core/index";
+@import "objects/index";
+
+@import "components/index";
+
+@import "utilities/index";
+@import "overrides/index";
+
+/*# sourceMappingURL=index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/objects/_all.scss b/packages/govuk-frontend/dist/govuk/objects/_all.scss
index 50c692a7a..a393b2724 100644
--- a/packages/govuk-frontend/dist/govuk/objects/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/objects/_all.scss
@@ -1,8 +1,10 @@
-@import "button-group";
-@import "form-group";
-@import "grid";
-@import "main-wrapper";
-@import "template";
-@import "width-container";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/objects/all' is deprecated. Update your import statement to import 'govuk/objects/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/objects/_index.scss b/packages/govuk-frontend/dist/govuk/objects/_index.scss
new file mode 100644
index 000000000..9a9ec28cd
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/objects/_index.scss
@@ -0,0 +1,8 @@
+@import "button-group";
+@import "form-group";
+@import "grid";
+@import "main-wrapper";
+@import "template";
+@import "width-container";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/overrides/_all.scss b/packages/govuk-frontend/dist/govuk/overrides/_all.scss
index 0e9a9fb14..d28d0e7a9 100644
--- a/packages/govuk-frontend/dist/govuk/overrides/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/overrides/_all.scss
@@ -1,7 +1,9 @@
-@import "display";
-@import "spacing";
-@import "text-align";
-@import "typography";
-@import "width";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/overrides/all' is deprecated. Update your import statement to import 'govuk/overrides/index'."
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/overrides/_index.scss b/packages/govuk-frontend/dist/govuk/overrides/_index.scss
new file mode 100644
index 000000000..27886c3b1
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/overrides/_index.scss
@@ -0,0 +1,7 @@
+@import "display";
+@import "spacing";
+@import "text-align";
+@import "typography";
+@import "width";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_all.scss b/packages/govuk-frontend/dist/govuk/settings/_all.scss
index b28454af9..7fc16e9b4 100644
--- a/packages/govuk-frontend/dist/govuk/settings/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/settings/_all.scss
@@ -1,23 +1,10 @@
-// The order we import settings in is important, as some settings files rely on
-// others
-
-@import "assets";
-
-@import "warnings";
-@import "global-styles";
-
-@import "media-queries";
-
-@import "colours-palette";
-@import "colours-organisations";
-@import "colours-applied";
-
-@import "spacing";
-@import "measurements";
-
-@import "typography-font";
-@import "typography-responsive";
-
-@import "links";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/settings/all' is deprecated. Update your import statement to import 'govuk/settings/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_index.scss b/packages/govuk-frontend/dist/govuk/settings/_index.scss
new file mode 100644
index 000000000..e46fb4637
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/settings/_index.scss
@@ -0,0 +1,23 @@
+// The order we import settings in is important, as some settings files rely on
+// others
+
+@import "assets";
+
+@import "warnings";
+@import "global-styles";
+
+@import "media-queries";
+
+@import "colours-palette";
+@import "colours-organisations";
+@import "colours-applied";
+
+@import "spacing";
+@import "measurements";
+
+@import "typography-font";
+@import "typography-responsive";
+
+@import "links";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_warnings.scss b/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
index af64de8c0..e9fe535dc 100644
--- a/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
+++ b/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
@@ -37,17 +37,22 @@ $govuk-suppressed-warnings: () !default;
/// - To format the passed warning `$message` with the warning key at the end
/// - To prevent duplicate warnings by adding the passed `$key` to
/// `$govuk-suppressed-warnings` after `@warn` is called to ensure it only runs
-/// once per sass compilation
+/// once per sass compilation (unless $silence-further-warnings is false)
///
/// @param {String} $key - The key to be checked against `$govuk-suppressed-warnings`
/// and then passed to it to prevent multiple of the same warning.
/// @param {String} $message - The message to use when calling `@warn`
+/// @param {Boolean} $silence-further-warnings - Whether to silence future
+/// warnings that use the same $key
/// @access private
-@mixin _warning($key, $message) {
+@mixin _warning($key, $message, $silence-further-warnings: true) {
@if _should-warn($key) {
@warn _warning-text($key, $message);
- $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
+
+ @if $silence-further-warnings {
+ $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
+ }
}
}
diff --git a/packages/govuk-frontend/dist/govuk/tools/_all.scss b/packages/govuk-frontend/dist/govuk/tools/_all.scss
index 8c5556175..857712d6b 100644
--- a/packages/govuk-frontend/dist/govuk/tools/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/tools/_all.scss
@@ -1,7 +1,10 @@
-@import "exports";
-@import "font-url";
-@import "image-url";
-@import "px-to-em";
-@import "px-to-rem";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/tools/all' is deprecated. Update your import statement to import 'govuk/tools/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/tools/_index.scss b/packages/govuk-frontend/dist/govuk/tools/_index.scss
new file mode 100644
index 000000000..df0739053
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/tools/_index.scss
@@ -0,0 +1,7 @@
+@import "exports";
+@import "font-url";
+@import "image-url";
+@import "px-to-em";
+@import "px-to-rem";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/utilities/_all.scss b/packages/govuk-frontend/dist/govuk/utilities/_all.scss
index 77dbb46ba..cc1da2ab0 100644
--- a/packages/govuk-frontend/dist/govuk/utilities/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/utilities/_all.scss
@@ -1,4 +1,10 @@
-@import "clearfix";
-@import "visually-hidden";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+ "import-using-all",
+ "Importing using 'govuk/utilities/all' is deprecated. Update your import statement to import 'govuk/utilities/index'.",
+ $silence-further-warnings: false
+);
/*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/utilities/_index.scss b/packages/govuk-frontend/dist/govuk/utilities/_index.scss
new file mode 100644
index 000000000..7adb7f6c5
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/utilities/_index.scss
@@ -0,0 +1,4 @@
+@import "clearfix";
+@import "visually-hidden";
+
+/*# sourceMappingURL=_index.scss.map */
Action run for 85e7fe4 |
If we're happy with this change we should create an issue to clean up the We'll also need to add a changelog entry and update any documentation that has examples that import the |
owenatgov
reviewed
Apr 29, 2024
This is useful if we want to make users aware of all of the related issues at once (rather than playing whack-a-mole fixing one at a time), but still allow them to silence them using a single key.
36degrees
added a commit
to alphagov/govuk-frontend-docs
that referenced
this pull request
Apr 29, 2024
Update the documentation to suggest importing using `index` files rather the now-deprecated `all` files following the changes in alphagov/govuk-frontend/pull/4955 [1] [1]: alphagov/govuk-frontend#4955
owenatgov
approved these changes
Apr 30, 2024
36degrees
added a commit
that referenced
this pull request
May 10, 2024
After the changes in #4955 we need to follow the instructions in our own deprecation message to update the imports from our full-page examples: ``` Importing using 'govuk/core/all' is deprecated. Update your import statement to import 'govuk/core/index'. ```
36degrees
added a commit
that referenced
this pull request
May 17, 2024
In #4955 we renamed all of the entrypoints within the individual layers from `all.scss` to `index.scss`, leaving `all.scss` in place as an alias that outputs a deprecation warning. We also inadvertently introduced an `index.scss` in the root ‘govuk’ folder but with identical contents to `all.scss`. [1] We ultimately intend to rename this root entrypoint to `index.scss` to be consistent with the other changes, but this requires further changes to our documentation, entrypoints in package.json etc. In order to get the next release out, we’re just going to make `all.scss` a proxy for `index.scss`, without adding a deprecation warning. We’ll make those changes and introduce a deprecation warning in a future release. [1]: https://github.com/alphagov/govuk-frontend/pull/4955/files#diff-ec46cef55fb94c8061eaf2fd3f241998f9a13d56fdad7018fe1712e00d5ae3aa
Merged
This was referenced May 17, 2024
domoscargin
pushed a commit
that referenced
this pull request
Jun 19, 2024
In #4955 we renamed all of the entrypoints within the individual layers from `all.scss` to `index.scss`, leaving `all.scss` in place as an alias that outputs a deprecation warning. We also inadvertently introduced an `index.scss` in the root ‘govuk’ folder but with identical contents to `all.scss`. [1] We ultimately intend to rename this root entrypoint to `index.scss` to be consistent with the other changes, but this requires further changes to our documentation, entrypoints in package.json etc. In order to get the next release out, we’re just going to make `all.scss` a proxy for `index.scss`, without adding a deprecation warning. We’ll make those changes and introduce a deprecation warning in a future release. [1]: https://github.com/alphagov/govuk-frontend/pull/4955/files#diff-ec46cef55fb94c8061eaf2fd3f241998f9a13d56fdad7018fe1712e00d5ae3aa
This was referenced Jun 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use
index
as the entrypoint for each layer as it:Keep the existing
all
files as aliases, but add deprecation warnings when importing via them so we can remove those files in the next major release.Fixes #4960
Footnotes
https://sass-lang.com/documentation/at-rules/import/#index-files ↩
https://tannerdolby.com/writing/using-index-files-in-sass/ ↩