Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !7081

Save some traffic: round mantissa length of percentage values to two.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/jgehrcke/percentage-precision into master Feb 26, 2013
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: jgehrcke

The bootstrap-responsive.css from Bootstrap 2.3 contains several percentage numbers with unnecessarily high precision, such as

width:31.570740134569924%

There are 148 of those:

$ grep -Hno '\.[0-9]\{3,\}%' bootstrap/css/bootstrap-responsive.css | wc -l
148

By rounding all percentages in bootstrap-responsive.min.css to at maximum two digits after the decimal point, the size of the file is reduced by 11 %.

Regarding a percentage number, a mantissa length of two means that the absolute length given by that relative value is defined with a precision of the 10000th part of the absolute reference length. This is more than enough as long as screens do not have significantly more than 10000 pixels in either dimension.

I've created the patch in a rather ignorant fashion: added round(number, 2) function calls until all of these long numbers disappeared. I actually have never dealt with LESS and Bootstrap LESS files before, so this patch is required to be reviewed carefully.

I'm not sure if there will be another 2.X (bugfix) release, so maybe this patch does not make sense with respect to 2.X at all. I'll have a look if there is the same situation with Bootstrap 3.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jgehrcke/percentage-precision