Modular CSS | World Anvil

Remove these ads. Join the Worldbuilders Guild

Modular CSS

New Feature Addition · Articles & templates · Created by KahunaTheElder
accepted
CSS Modular -Styling
Currently, those with the permissions to use advanced CSS in their pages need to either put all CSS into the Global CSS or copy and paste lesser-used CSS snippets into individual pages. For on-off CSS styling, this is not a real problem, but for worlds where sections of the world use similar styling, this can result in much copy and pasting, or bloated CSS.   The same can be said for font definitions, which either need to be loaded on the individual page, or in the Global CSS.   The idea for modular CSS is to create something like we currently use for statblocks, where CSS is put into a snippet, which is then called on the individual page. For example, if you want to use a "chalkboard" background and font, those could all be called with one modular CSS definition on any page that needs it, without loading it on pages that do not. It also eliminates the need of repeating the CSS code on each page that requires it. And lastly, keeping all the code within the WA system provides for the ability to have checks for security.   The end result should be quicker load times on a large number of pages, and less server load when not loading tons of CSS that is unused on a page. It also will allow easier use of CSS code as needed. In addition, it can make testing of new code much easier, and safer, as the reference to the code snippet can be removed easily.

The Team's Response

Hasn't reached target 300 votes in 20 days   This was already something I have suggested myself support is rather low so it will get lower priority but I believe it can really help [MEDIUM PRIORITY]
Current score

42/300 Votes · +4840 points

Votes Cast

  • +100

    by Llanyia
    on 2021-04-29 17:58
  • +200

    by esongbird24601
    on 2021-04-17 12:29
  • +100

    by A Lambent Eye
    on 2021-04-17 12:26
  • +10

    by AmélieIS
    on 2021-04-17 12:26
  • +300

    by WriterGreg
    on 2021-04-17 12:21
  • +50

    by Sehanbrel
    on 2021-04-16 09:35
  • +300

    by J B Dorman
    on 2021-04-16 02:25
  • +100

    by SinTeKoe
    on 2021-04-16 01:31
  • +50

    by Fadedsaint
    on 2021-04-15 18:52
  • +50

    by MockTurtle
    on 2021-04-15 17:34
  • +20

    by SpectreSloth
    on 2021-04-13 15:53
  • +200

    by munkey_ninja
    on 2021-04-13 02:09
  • +100

    by momococa
    on 2021-04-12 08:28
  • +300

    by Kaleidechse
    on 2021-04-11 09:09
    My world currently has one “parent” CSS theme plus several “child” themes for different ethnicities. Having a proper way to organize these would be great! I can imagine a central place to define the CSS for child themes, and then a dropdown in the article settings for selecting one of them. At display time, the child theme would then be sitting between the world CSS and article-specific CSS.
  • -200

    by ka_jan
    on 2021-04-11 08:08
    (Load) Order is important in CSS and this feels flimsy. I'd rather have per article themes.
  • +300

    by Dylonishere123
    on 2021-04-11 00:54
  • +10

    by lengna
    on 2021-04-10 11:31
  • +50

    by xtremepsy
    on 2021-04-10 03:27
  • +100

    by lthomas224
    on 2021-04-10 01:13
  • +10

    by DarkAegyptiacus
    on 2021-04-09 22:05
  • +50

    by Bereaved-Messiah
    on 2021-04-09 20:01
  • +100

    by Vertixico
    on 2021-04-09 16:59
    I like the idea of "css blocks". This would make the main css more readible as well. Also, css blocks would then become something to share. Want a specific border for your quote? Maybe someone made a css-block for that you can load into your world style as a plugin or your one article.
  • +50

    by Lethann
    on 2021-04-09 16:35
    This would be a great idea. I've not tried to customize the CSS in sections of my world because of the hassle, instead using only global.
  • +300

    by dinosaurbob
    on 2021-04-09 14:26
    Improved reader experience thanks to better page loading times? How can I refuse!
  • +10

    by A Lusty Dwarf
    on 2021-04-09 07:11
  • +100

    by Tiirikka
    on 2021-04-09 06:16
  • +10

    by DoctorGearbox
    on 2021-04-09 04:54
  • +200

    by HarleyQ
    on 2021-04-09 04:32
  • +20

    by brass_phoenix
    on 2021-04-08 18:35
  • +10

    by Hondor23
    on 2021-04-08 15:40
  • +20

    by Kraheera
    on 2021-04-08 14:16
  • +300

    by Uruschk
    on 2021-04-08 12:27
  • +100

    by Schmauch
    on 2021-04-08 06:39
  • +50

    by redbeardcreator
    on 2021-04-08 06:01
    Anything that makes management of CSS easier would be welcome.
  • +50

    by BCGR_Wurth
    on 2021-04-08 04:28
  • +10

    by spartango
    on 2021-04-08 02:44
    While I'm not entirely against this idea, I like the idea of creating a library of CSS files more (which is something Dimi has mentioned in the past). https://discord.com/channels/348060277989965844/413706576470474753/736461668938154004
  • +300

    by A Lusty Hobbit
    on 2021-04-08 02:07
  • +200

    by michaelthominks
    on 2021-04-08 00:14
  • +300

    by MarkusD
    on 2021-04-07 19:06
  • +100

    by Adcheryl
    on 2021-04-07 17:56
  • +100

    by resdamalos
    on 2021-04-07 17:22
  • +10

    by KajetanWrites
    on 2021-04-07 17:05
    I like that idea. However, I think a simpler way to edit CSS would be better. For example, a way to tweak themes without having to write code
  • +300

    by KahunaTheElder
    on 2021-04-07 16:55