Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !2307

Closed
Created Dec 18, 2012 by Administrator@rootOwner
  • Report abuse
Report abuse

Split CSS files

  • Overview 12
  • Commits 2
  • Changes 3

Created by: riyad

This is an ugly hack trying to split the CSS files to stay below 4096 selectors per file necessary for IE. This is only meant as a temporary solution.

The problem:

  • Bootstrap is big
  • We override quite some stuff of it
  • We use @extend for importing style rules
  • Our styles are really sensitive to order

Bootstrap + our overrides are 3400+ selectors!!!

I have tried splitting the one big CSS file into several smaller ones:

  • vendor.css includes all CSS from vendor/assets (luckily they have no dependencies) 296 selectors
  • highlight.scss contains the Pygments highlight styles (depends only on color variables) 246 selectors
  • gitlab_bootstrap.scss contains the pulled together Bootstrap styles + our overrides (ugly, big and brittle) 3438 selectors
  • sections.scss contains all section styles without @extends 223 selectors
  • sections_extended.scss contains all section styles with @extends (this means gitlab_bootstrap.scss needs to be included here) :/ 4050 selectors
  • main.scss conains the rest (headers, themes, common definitions) (also depends on gitlab_bootstrap.scss) 3841 selectors
  • application.css aggregates all of them (includes Bootstrap twice 💩 ) 8657 selectors

Selectors counted with this.

What we get:

  • Non-IE browsers get served application.css as before.
  • IE downloads the CSS files separately.

Caveat:

  • gitlab_bootstrap.scss is included twice: in main.scss and sections_extended.scss
  • You can't combine all styles depending on gitlab_bootstrap.scss into one, because it would be too big again :(

Fixes #1842 (closed) Fixes #2073 (closed)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/riyad/split-css-files-for-ie