Adding CSS or JS file to MediaWiki?

后端 未结 3 1690
旧巷少年郎
旧巷少年郎 2021-01-05 06:02

I\'ve been following some tutorials at mediawiki.org but I didn\'t make it. I need to add a new CSS or JS code to be available in all my wiki (basically be cause I need to a

3条回答
  •  星月不相逢
    2021-01-05 06:26

    If you plan to reuse and extend an existing MediaWiki theme, you do not need to add a new CSS file. It is much easier.

    Suppose your Wiki is running on mywiki.local/wiki/, and we use the Vector skin.

    Now all you have to do, is to open mywiki.local/wiki/MediaWiki:Vector.css and add the styles for the DIVs you add to pages.

    The real question here is: do you plan to modify the skin itself, or do you just plan to add your own DIVs into Wiki pages? Anyway, in both cases you can edit the skin CSS via MediaWiki to avoid hacking around in the file system - which breaks with each update.

    Avoid editing MediaWiki files at any cost, upgrades become painful that way.

    If you want to make styles for your DIVs in pages available to all MediaWiki skins, you have to edit mywiki.local/wiki/MediaWiki:Common.css. Changes made here are applied to all skins.

提交回复
热议问题