Skip to content

Commit

Permalink
Fix theme-auto loading (go-gitea#23504)
Browse files Browse the repository at this point in the history
Fix regression from go-gitea#23481.

The conditional on the CSS import was being stripped away by webpack's
`css-loader`, resulting in the dark theme always loading. The old syntax
with `@import` nested inside `@media` also did not work as `css-loader`
(rightfully) ignores such non-standard `@import` syntax that was
previously supported by Less.

Unfortunately, we have to re-introduce postcss to the CSS pipeline to
fix this and I loaded only the minimal plugins to make it work.

There is one variant of the fix that does work without postcss, which is
to exclude the file from transpilation but I did not consider it as it
would have meant the `@import` was being done without a version suffix
in the URL, which would have caused cache issue.

Related: webpack-contrib/css-loader#1503

---------

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
  • Loading branch information
silverwind and jolheiser committed Mar 16, 2023
1 parent 93528bd commit e93d666
Show file tree
Hide file tree
Showing 4 changed files with 313 additions and 54 deletions.
Loading

0 comments on commit e93d666

Please sign in to comment.