Skip to content

Conversation

roland-ruedenauer
Copy link
Contributor

@roland-ruedenauer roland-ruedenauer commented May 4, 2025

This PR should fix the remaining issues listed in #1770.

Problem with running ./m css for now:
The package XStatic-Bootstrap installed with moin does not contain the scss files required by the sass compiler.
The CSS files for the Basic theme were created by locally patching the bootstrap package before running ./m css.
This is the reason I chose to use the draft status for this PR.

A new release of XStatic-Bootstrap should provide the required scss files.

Regarding the use of Font Awesome icons:
Making use of the regular icons instead of the solid ones would probably make the Basic theme look a bit nicer.

Please note that Boostrap switched from Less to Sass with version 4 already. Moin was using the Bootstrap 4 CSS files even before this PR.

It would be good if someone could test the changes made in this PR and check, if there are still issues left to fix when using the Basic theme.

@roland-ruedenauer
Copy link
Contributor Author

Removing draft status as it is unclear when a new XStatic-Bootstrap release will be available (see pending MR).

A workaround for using "./m css" would be copying scss files to xstatic/pkg/bootstrap/data/ in the local python package cache.

@roland-ruedenauer roland-ruedenauer marked this pull request as ready for review May 14, 2025 09:32
@RogerHaase
Copy link
Member

RogerHaase commented May 19, 2025

Testing on Windows 10 fails with:

(moin-venv-python) C:\Clones\Roland-ruedenauer\moin>m css
Running sass to update Basic theme CSS files...
Deprecation Warning [import]: Sass @import rules are deprecated and will be remo
ved in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
3 │ @import "notice";
  │         ^^^^^^^^
  ╵
    scss\theme.scss 3:9  root stylesheet

Deprecation Warning [import]: Sass @import rules are deprecated and will be remo
ved in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

  ╷
6 │ @import "bootstrap";
  │         ^^^^^^^^^^^
  ╵
    scss\theme.scss 6:9  root stylesheet

Error: Can't find stylesheet to import.
  ╷
6 │ @import "bootstrap";
  │         ^^^^^^^^^^^
  ╵
  scss\theme.scss 6:9  root stylesheet
Error: Basic theme CSS files update failed, see error messages above.

The basic theme.css file was updated:

/* Error: Can't find stylesheet to import.
 *   ,
 * 6 | @import "bootstrap";
 *   |         ^^^^^^^^^^^
 *   '
 *   scss\theme.scss 6:9  root stylesheet */

body::before {
  font-family: "Source Code Pro", "SF Mono", Monaco, Inconsolata, "Fira Mono",
      "Droid Sans Mono", monospace, monospace;
  white-space: pre;
  display: block;
  padding: 1em;
  margin-bottom: 1em;
  border-bottom: 2px solid black;
  content: "Error: Can't find stylesheet to import.\a   \2577 \a 6 \2502  @import \"bootstrap\";\a   \2502          ^^^^^^^^^^^\a   \2575 \a   scss\\theme.scss 6:9  root stylesheet";
}

@roland-ruedenauer
Copy link
Contributor Author

@RogerHaase Thanks for looking into the PR.

Did you actually copy the bootstrap 4.5.3 scss files into the XStatic-Bootstrap site-packages folder as mentioned in my comment above? Running "./m css" requires those files to be installed but they currently are not part of the latest XStatic-Bootstrap release.

$ ll ../moin-venv-python3/lib/python3.13/site-packages/xstatic/pkg/bootstrap/data/
insgesamt 20
drwxr-xr-x 5 roland roland 4096 19. Mai 22:44 .
drwxr-xr-x 4 roland roland 4096 19. Mai 22:38 ..
drwxr-xr-x 2 roland roland 4096 19. Mai 22:38 css
drwxr-xr-x 2 roland roland 4096 19. Mai 22:38 js
drwxr-xr-x 5 roland roland 4096 19. Mai 22:43 scss

With the scss files installed I was able to run the command without errors and produce the CSS files for the Basic theme. The sass invocation will log a good amount of deprecation warnings though. My plan was to fix this stuff, when finally switching to Bootstrap 5 (current) in a separate PR.

@RogerHaase
Copy link
Member

After copying scss directory I was able to successfully run m css.

To repeat the process in more detail:

  1. point your browser to https://github.com/twbs/bootstrap/tree/v4.5.3/scss
  2. modify the browser url to https://ssgithub.com/twbs/bootstrap/tree/v4.5.3/scss
  3. click the download button to save a zip file to a convenient location
  4. unzip the file to xstatic/pkg/bootstrap/data creating a scss directory as a sibling to the existing css and js directories

I am doing a b3 release this week. I think it would be best to merge this after the release.

@RogerHaase
Copy link
Member

@roland-ruedenauer Please resolve the conflict, then I will merge this.

@UlrichB22
Copy link
Collaborator

UlrichB22 commented Jun 4, 2025

@roland-ruedenauer IMO you can remove themes/__init__.py from your PR and use the actual version from master branch. The icon mapping has been moved to constants/misc.py and your change of icon names is already included.

@roland-ruedenauer
Copy link
Contributor Author

I've rebased the changes onto the master branch

@RogerHaase RogerHaase merged commit ac41b95 into moinwiki:master Jun 4, 2025
8 checks passed
@roland-ruedenauer roland-ruedenauer deleted the migrate-to-sass branch June 4, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants