Search code examples
csspostcsstailwind-css

TailWindCSS Super Config


So I want to make a TailWindCSS Super Config in which I have every height fraction up-to 12, same for height screen and font size, and a lot of colours.

I know that TailWindCSS gives a pretty good default config, but I want it bigger, better. FileSize is not an issue for the CSS and it is going to be Purged, after working with PurgeCSS for a little while, I feel confident that it will only include what is needed.

Having a large StyleSheet does mean that some developers may take it too far and start to overuse classes, however I personally feel that this will not be an issue within my company, and I would still like to have a large config.

I want to automatically generate the config so that I can have the 1/2, 2/3, 5/5 etc generated without me having to enter them manually into the config, along with this I want every variant for every attribute, making the end CSS even bigger!


In Short, I would like a way to generate some of the config automatically, and I want to know the correct order to declare the config (EG: height, width, box shadow etc).

Thanks, Justin.


Solution

  • So, the result of my investigations is just to use the native ability of Javascript to generate parts of the config automatically, saving me time writing out config lines.

    myVariants = {};
    
    for(let x = 1; x < 12; x++)
      myVariants[x + "/12"] = (8.33333 * x) + "%";
    
    console.log(myVariants);

    There is much more you can do to make your config even more automated too!