Module talk:Information/styles.css

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

IMPORTANT[edit]

For technical reasons, all the styles from Module:Information/styles.css are also copied to MediaWiki:Filepage.css. Anyone who edits them should take care to keep them in sync. This talk page section features more information about this.

The reason for this is that, if {{Information}} uses the equivalent of <templatestyles src="Module:Information/styles.css" /> (via Lua), the templatelinks table in the database contains three rows – for Template:Information, Module:Information, and Module:Information/styles.css – for every use of {{Information}}: hundreds of millions of rows. To reduce this number by (about) a third, Module:Information skips adding the templatestyles in the File namespace, and files instead get the same styles via MediaWiki:Filepage.css, which is loaded automatically by MediaWiki and doesn’t require any templatelinks rows. (This means that files without {{Information}} also get these styles, but that shouldn’t hurt. Non-File pages still import these styles via templatestyles.)

One consequence of this is that edits to these styles cannot be tested on File pages with the “Preview page with this template” feature; if you want to see a preview of your edited styles, make sure to preview a page outside the File namespace. Copy the {{Information}} block you want to test to your user sandbox page, if necessary.

Note that all this works well with other wikis that use files from Commons: MediaWiki automatically loads Commons’ Filepage.css on their file description pages as well, so the styles will still be present there.

See Module talk:Information#Proposal: Move template styles to site-wide CSS for previous discussion of this technique, and T343131 for a lot more discussion of the growth of the Commons database and many proposed measures to slow the growth, such as this one. Lucas Werkmeister (talk) 21:02, 30 January 2024 (UTC)[reply]