preserve ti-fw classes for icons - fixes #580

I thought that `ti-fw` was mostly useless, but it turns out that:

- it affects the alignment of icons in many places

- it's set separately in some places
  (e.g. `packages/frontend/src/ui/_common_/navbar.ts` has `<i
  class="ti-fw" :class="[$style.itemIcon,
  navbarItemDef[item].icon]"></i>`)

so we have to keep it around.
This commit is contained in:
dakkar 2024-07-15 16:33:10 +01:00
parent f9a09b0358
commit ded459304e

View file

@ -5,10 +5,9 @@ function iconsReplace(opts: RollupReplaceOptions) {
return pluginReplace({
...opts,
preventAssignment: false,
// only replace these strings at the start of strings, remove a
// `ti-fw` it if happens to be just after, and make sure they're
// followed by a word-boundary that's not a dash
delimiters: ['(?<=["\'`])', '(?: ti-fw)?\\b(?!-)'],
// only replace these strings at the start of strings, and make
// sure they're followed by a word-boundary that's not a dash
delimiters: ['(?<=["\'`])', '\\b(?!-)'],
});
}