Last modified: 2014-09-23 21:49:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 15075 - Per book, category and/or template CSS and JavaScript
Per book, category and/or template CSS and JavaScript
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
All All
: Low enhancement with 4 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on: 15071
  Show dependency treegraph
Reported: 2008-08-07 18:49 UTC by Mike.lifeguard
Modified: 2014-09-23 21:49 UTC (History)
13 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Mike.lifeguard 2008-08-07 18:49:10 UTC
This would allow a stylesheet to apply to only a particular book. Important mostly for the Wikijunior project, but would be useful as well for any Wikibooks. Should also allow per-book javascript.
Comment 1 Siebrand Mazeland 2008-08-10 22:58:29 UTC
Sounds you you would want some tag that would enable you to set which .css in the MediaWiki: namespace should be used.

Is that what you mean?
Comment 2 Andrew Whitworth 2008-10-01 16:47:24 UTC
Yes, that sounds like exactly what they are talking about. The ability to switch .CSS files (and possibly .JS files too!) depending on the name of the book.
Comment 3 Helder 2009-09-17 17:58:52 UTC

Wouldn't be a better approach to have CSS and JS per *categories*?

Then, since all pages of a wikibook is usually in the category with the name of the book, the CSS would be applied without having to tag each page of the books.

Using categories, this would also be useful for Wikipedia, because it is common to have all pages from a category sharing the same style, mainly by means of the templates/infoboxes ([[Category:Wikipedia template categories]] and [[Category:Infobox templates]]);

The same would be great for javascript, because if we could load a script only if the page is at some category we would be able to load a script which is useful only for some pages exactly on those pages, not in every one. For example, not every page has a sortable table ([[Help:Sorting]]) or a collapsible content ([[Help:Collapsing]] and [[Wikipedia:NavFrame]]), but such scripts are loaded for all pages (NavFrame and Collapsible tables are at [[MediaWiki:Common.js]] and sortable tables at This also happens in other projects then Wikipedia.

Maybe this could be at [[Category:Name of category.css]] and [[Category:Name of category.js]], similar to what we have for user scripts/css.

Comment 4 Helder 2009-09-17 20:56:07 UTC
By the way, there are other situations where per category scripts would be useful, and I just find another:
Currently, [[MediaWiki:Common.js]] has a script which "Adds editintros on disambiguation pages and BLP pages."

It load EditIntros according to the categories the articles belongs to...

Comment 5 Helder 2010-11-20 13:49:54 UTC
See also the option mentioned in bug 2212#c9.
Comment 7 Krinkle 2014-08-28 20:19:24 UTC
This is about page rendering and the load queue of scripts (which eventually end up loaded with ResourceLoader). 

About as related to ResourceLoader as it is to Apache (which delivers the code eventually).

Note You need to log in before you can comment on or make changes to this bug.