Giter Site home page Giter Site logo

Rename dims class about iconizr HOT 5 CLOSED

jkphl avatar jkphl commented on July 21, 2024
Rename dims class

from iconizr.

Comments (5)

jkphl avatar jkphl commented on July 21, 2024

Hi @dugokontov,

your suggestion only works as long as all icons have the same dimensions — which doesn't need to be true (and in reality often is not). So there's no way to define a common dimension class.

In case all your icons have the same dimensions, feel free to suppress the generation of dimension classes and add the single dim class in your own / custom stylesheet.

Cheers,
Joschi

from iconizr.

dugokontov avatar dugokontov commented on July 21, 2024

I think you didn't understand me. There will not be one .dims class for all icons. There will be separate one for every icon in sprite. Let me expand example from above:

.icon-arrow,.icon-arrow\:regular{background-image:url('svg/icons.svg');background-position:0 0;background-repeat:no-repeat}
.icon-arrow.dims{width:22px;height:15px}

.icon-search,.icon-searc\:regular{background-image:url('svg/icons.svg');background-position:0 23px;background-repeat:no-repeat}
.icon-search.dims{width:12px;height:50px}

As you can see adding just .dim class to any element will not do anything. So this will not apply any stile:

<div class="dims"></div>

For this div element to convert to any icon you have to add "icon" class, like this:

<div class="icon-arrow dims"></div>

and it will set width/height to 22px/15px. To display search icon create this html:

<div class="icon-search dims"></div>

and it will set width/height to 12px/50px.

I find this to be much cleaner than how it works now:

<div class="icon-search icon-search-dims"></div>

Not to say that it can easily produce errors on copy paste, where you apply dimensions from wrong icon, like this:

<div class="icon-search icon-arrow-dims"></div>

from iconizr.

jkphl avatar jkphl commented on July 21, 2024

Hi @dugokontov,

thanks for the explanation. I do understand your point now (and partly like the idea), although I don't fully agree with your statement that this is much cleaner. In fact, I see several possible implications:

  • IMO, using the same class name for specifying the (individual) sizes of all icons somehow suggests that they all have the same size. I don't mind using more verbose — and more meaningful — class names.
  • The support for chained CSS class names is pretty good but not identical to separate classes. Also, I don't have any insights about the support on the various mobile platforms.
  • I'm not sure about the specificity implications of the chained classes. What happens when you define additional properties for the dims class? This might be a feature, but also a problem ...

Anyway, I see your point and I understand that this might come in handy in certain situations. Having said this, I recommend you to have an eye on the Node respectively Grunt based version of iconizr, which feature Mustache template based output rendering. Possibly you can achieve your proposal by modifying the output templates appropriately. Additionally, I might consider adding a switch to control the dimension class names in one of the next releases. Given that you posted this to the original PHP based version of iconizr, I must draw your attention to the fact that this is the most outdated version. I plan to improve it and move it to the same level as the Node / Grunt based versions someday, but please don't expect this to be in the nearest future.

Cheers,
Joschi

from iconizr.

dugokontov avatar dugokontov commented on July 21, 2024

Ok, thanks for the info.

I used this repo since this is the link you provided in footer of http://iconizr.com/ webpage: "You may report any issue there as well"

from iconizr.

jkphl avatar jkphl commented on July 21, 2024

@dugokontov thanks! Yes, unfortunately the iconizr.com website along with the PHP version of iconizr (which the website is based on) is rather outdated and I just can't find the time to work on either of them :(

from iconizr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.