question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reduce size of generated CSS / more control over auto-generated helpers

See original GitHub issue

Bootstrap generates a lot of helper functions based on breakpoints which leads to many classes which may be unused in production CSS. The problem gets even bigger if you want to add another breakpoint. Now since offset-* classes are back this isn’t helping either.

In order to have more granular control I would suggest to add more option variables to allow the developer to choose which helpers should be auto generated and which ones not. I’ll add some examples below.

Do you have any other plans or ideas in implementing such a feature? If necessary I would prepare a PR if this seems legit to be implement.

In case of _flex.scss it would be useful to limit the breakpoints for which the helpers should be generated as well as disabling some helpers at all. In this case I would suggest a new variable $flex-breakpoints which inherits its values from $grid-breakpoints as a default. Then I’d suggest the variables $enable-flex-justify-content, $enable-flex-align-items, $enable-flex-align-content, $enable-flex-align-self to enable or disable auto generation of these helpers. For the other flex-* helpers I’m currently unsure if there should be variables for each of them, or just disabling the wrap helpers or if we just keep them all the time as they were needed more often then the others.

The same scheme can be applied to _grid-framework.scss where I would create variables $enable-grid-order and $enable-grid-offset to disable them. Offsets, may not be used by many people since they had been removed and brought back in the newest beta.

I’d really appreciate your thoughts about this. In my opinion this would help developers a lot to keep their CSS small.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MartijnCuppenscommented, Jan 6, 2019

We could approach this like Tailwind does, but keep using sass for it: https://github.com/tailwindcss/tailwindcss/blob/master/defaultConfig.stub.js

0reactions
mdocommented, Jul 13, 2019

Closing this out as we’ve added the majority of it with @MartijnCuppens’s work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto-placement in grid layout - CSS: Cascading Style Sheets
The default for automatically created rows in the implicit grid is for them to be auto-sized. This means that they will contain the...
Read more >
[Solved] allow zoom without affecting layout - CSS-Tricks
How can I allow user to zoom in and out without affecting the viewport size? For example: The actual device width is: 1920px....
Read more >
Use CSS to Auto-Generate Image Thumbnails - the new code
Taking full-size gallery images and clipping them to size as navigational images would eliminate those steps, lowering page creation time. It ...
Read more >
Reduce HTML5 file size - Studio Help - Google Support
Reduce image size​​ Some image elements may be replaced with CSS styles. Below are suggestions and resources for reducing the number of images...
Read more >
General Config Settings | Craft CMS Documentation | 3.x
Craft supports several configuration settings that give you control over its behavior. To set a new config setting, open config/general.php and define it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found