Giter Club home page Giter Club logo

Comments (6)

jakesgordon avatar jakesgordon commented on June 3, 2024

You're right, that is an issue. The current library simply assumes that all the files live in a single directory and have unique names - in fact its a fluke that it picks up images in the sub-directories at all!

Obviously, short term, the recommendation would be to either sprite those sub-directories individually, or put all images into a single directory and give them unique names (e.g. "icons_client.png" and "titles_client.png")...

... but I can see that being a useful feature. I think the trick to backward compatibility would be to get the sprite factory to use a relative path name (e.g relative to input - the top level folder being sprited). So if the target is a single folder (like the current tests) then the base file name will end up being used (same as today), but if the target contains sub folders (like your example) then the library should take the relative path (e.g. icons/client.png) and replace '/' with '_', ending up with "icons_client" as the css class name

... but might take a little effort to get it working cleanly. I'll try to look into this for the next version.

Thanks for the suggestion.

from sprite-factory.

nfm avatar nfm commented on June 3, 2024

Ah, good thinking. That sounds like the right approach to me.

I'm happy to have a shot at implementing this if that'd be helpful. Let me know what works for you.

from sprite-factory.

jakesgordon avatar jakesgordon commented on June 3, 2024

I'll take a look at it this weekend and let you know how it goes.

from sprite-factory.

jakesgordon avatar jakesgordon commented on June 3, 2024

Latest master branch should fix this issue.

For your earlier example, you should now see unique classnames icons_client and titles_client in the generated CSS.

Let me know if that works for you, and I'll see about releasing a new version of the Gem.

Thanks!

from sprite-factory.

jakesgordon avatar jakesgordon commented on June 3, 2024

I released a new gem - version 1.4.2 with this fix in it.
notes

from sprite-factory.

nfm avatar nfm commented on June 3, 2024

Thanks @jakesgordon, 1.4.2 works a treat.

from sprite-factory.

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.