Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using .glyphicon .glyphicon- is cruel and unusual punishment #10201

Closed
tyler-johnson opened this issue Aug 26, 2013 · 5 comments
Closed

Using .glyphicon .glyphicon- is cruel and unusual punishment #10201

tyler-johnson opened this issue Aug 26, 2013 · 5 comments
Labels

Comments

@tyler-johnson
Copy link

I'm sure some where along the line there was a discussion about how icon classes should be declared, but how the current format was decided on is beyond me.

  • it takes forever to type by hand
  • impossible to switch to other icons-as-a-font libraries and keep the same code as most of them use Bootstrap 2.x .icon-
  • approx 17 extra bytes I don't want or need
  • just plain old silly

I believe it would be in the best interest of the Bootstrap community to start a serious discussion on standardizing the icon class names. More for than just for Bootstrap, too. Font-Awesome and the other icons-as-a-font libraries would benefit from standardization as well.

To me, it seems natural to stick to Bootstrap 2.x, (just .icon-), however extending with an extra .icon before it would also be better than the existing implementation.

@mdo
Copy link
Member

mdo commented Aug 26, 2013

Not gonna happen until at least v4, and that's not coming anytime soon.

it takes forever to type by hand

Not really a huge deal, nor a valid criticism in my opinion worth investing in further. Typing is pretty easy :). To make it even easier, check out if your editor has zen coding abilities—makes for super fast markup writing.

impossible to switch to other font libraries as most of them use Bootstrap 2.x .icon-

Find and replace works wonders. Also, you can customize the download to remove them or recompile your own version locally if you like.

approx 17 extra bytes I don't want or need

In the grand scheme of things, this isn't an issue either. Your pages should be gzipped and as such those repeated strings basically get counted once.

Overall, it comes down to performance. The attribute selectors we used in 2.x just don't cut it in larger projects and classes are way more performant. It also fits with our base and modifier class approach elsewhere in the project.

@mdo mdo closed this as completed Aug 26, 2013
@tlindig
Copy link
Contributor

tlindig commented Sep 3, 2013

I totally agree with @appleifreak.

The way you now chosen has the described harm without benefit. You taken a product name as class name, where you better use a semantic name. I can not see a technical reason for that.

To solve the performance problem and the base + modifier class approach, the only needed change was:

add a class "icon".

The usage than would be:

<i class="icon icon-search"></i>

Please rollback the bondage to use "glyphicon".

@fdaugan
Copy link

fdaugan commented Sep 15, 2013

  • it takes forever to type by hand
    • I've not seen "zen coding abilities" editor in requirements of BS3
    • Seriously increase risk of mispelling
    • "jQuery" is more usable with "$", I don't know a lot of people ready to switch to the jQuery object name.
  • approx 17 extra bytes I don't want or need
    • Gzip or not, replace("glyph","") save 1.1Ko of text to be parsed in "bootstrap.min.css"
    • Find and replace works wonder, so why not doing it in a vanilla BS?

I add this question : why exposing icon provider in BS3 in the end-developper code? I guess for adding a BS4 upgrade guide row.

@JoyceBabu
Copy link
Contributor

Can the prefix be made configurable using a variable? Font Awesome already does this.

@cvrebert cvrebert added the css label Mar 16, 2015
@Oxicode
Copy link

Oxicode commented Jul 2, 2015

👎

@twbs twbs locked and limited conversation to collaborators Jul 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants