Skip to content

Commit 638f7fb

Browse files
authored
Merge pull request #16466 from mozilla/FXA-9170-v2
chore(css): Add grunttask to fix content-server Tailwind selectors
2 parents 9ed55df + 19dbe6e commit 638f7fb

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/fxa-content-server/grunttasks/build.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ module.exports = function (grunt) {
4848
// Update leaf node font and image URLs in the CSS bundle.
4949
'usemin:css',
5050

51+
// Tailwind 3.4.1 changed ltr: and rtl: classes to use a `:where... &` selector
52+
// that can output an asterisk selector, e.g. `:where([dir="rtl"] *)`. Our `cssmin`
53+
// grunttask minifies this to `:where([dir="rtl"]*)`, removing the space, which
54+
// causes the style not to load. clean-css does not offer any formatting options
55+
// to fix this for us, and since we plan to sunset content-server anyway and this
56+
// is not a problem in our minification process for Settings, this is a temp hack
57+
// that replaces `]*` with `] *` in our content-server Tailwind CSS file.
58+
'replace:cssSelectorFix',
59+
5160
// URLs inside the resources with children have been updated
5261
// and SRI hashes added to the main JS bundle. These files
5362
// are in their final state and can now be revved.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
module.exports = function (grunt) {
6+
grunt.config('replace', {
7+
cssSelectorFix: {
8+
src: ['<%= yeoman.dist %>/styles/tailwind.out.css'],
9+
overwrite: true,
10+
replacements: [
11+
{
12+
from: /](?=\*)/g,
13+
to: '] ',
14+
},
15+
],
16+
},
17+
});
18+
};

0 commit comments

Comments
 (0)