Skip to content

more customization over css class names #23

Closed
maxogden opened this Issue Feb 21, 2012 · 8 comments

4 participants

@maxogden

hiya, this project rules but I have one minor request:

glue pizza/ sprites --simple

generates classnames like this: .sprite-pizza-awesome.png

glue pizza/ sprites --simple --namespace=

generates classnames like this: .-pizza-awesome.png

but I simply want to generate classnames like this: .sprite-awesome.png or even just awesome.png

is this possible?

cheers,

max

@jorgebastida
Owner

Fixed on master 0895d14

Thank you very much!

@maxogden

Nice - I see how to remove the namespace but I still don't see how to remove the folder name from the sprite prefixes. Here's an example:

given I have a folder called foo that has a.png and b.png, when I do

glue foo output --namespace=""

I get .foo-a and .foo-b, is there any way to get just .a and .b?

@jorgebastida jorgebastida reopened this Aug 16, 2012
@riebel
riebel commented Aug 29, 2012

I have the same problem. Is it possible to get rid of the folder name? I switch my sprite CSS depending on media queries. So I need the same classes for all resolutions.

@julen
julen commented Oct 3, 2012

There are some forks that already allow this. Any chance to merge the feature?

@jorgebastida
Owner

I'm working on this feature. The approach is going to be a --sprite-namespace command that you can null .

This option is going to solve some different problems like:

  1. I want to remove all the namespaces (original issue -namespace= --sprite-namespace=):

    .cat{...}
    .dog{...}

  2. You want to use the same namespace for all the sprites even if they come from different folders (--namespace= --sprite-namespace=farm or --namespace=farm --sprite-namespace=):

    .farm-cat{...}
    .farm-dog{...}

    This is quite useful if you want to only have one namespace but you want to split sprites in different images.

  3. You want to append/prepend something to the sprite namespace (--sprite-namespace="earth-%(sprite)s"):

    .sprite-earth-catfolder-cat{...}
    .sprite-earth-dogfolder-dog{...}

The command is working, but both the sprite and the manager validator need some refactoring in order to warn if some images are going to have the same CSS class name.

It should be ready soon,
Any thoughts?

@maxogden
maxogden commented Oct 4, 2012

The new commands look great

@jorgebastida
Owner

I've just pushed the changes to feature/sprite-namespace
https://github.com/jorgebastida/glue/compare/feature/sprite-namespace

I'll test it and merge them down into develop in order to release them as part of 0.2.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.