lucasmazza / spriteful

You know, sprites
Other
154 stars 13 forks source link

Add manifest-like config file for source/sprite destination/output mapping #20

Closed eshiota closed 10 years ago

eshiota commented 10 years ago

While the default behavior solves most of the problems, I have the following situation:

So, given a tree like this:

myproject/
  static/
    bin/
      img/
        icons/
        skins/
          [skin name]/
            icons/
    src/
      scss-components/
        base/
          skins/
            [skin name]/

and skins like "blue" and "red", I'd like to, in a single run, be able to generate an output like this:

myproject/static/bin/img/icons.png
myproject/static/bin/img/blue/icons.png
myproject/static/bin/img/red/icons.png
myproject/static/src/scss-components/base/_icons.scss
myproject/static/src/scss-components/skins/blue/_icons.scss
myproject/static/src/scss-components/skins/red/_icons.scss

I guess the easiest (and saner) way to do that would be using a manifest file, like:

{
  'sprites' : [
    {
      'src' : "myproject/static/bin/img/icons",
      'sprite_dest' : "myproject/static/bin/img",
      'stylesheet_dest' : "myproject/static/src/scss-components/base"
    }
  ]
}
lucasmazza commented 10 years ago

I had some thoughts of implementing this, but with either YAML or Ruby instead of JSON for readability, but the complexity of supporting this has been a downer for me to write this down. What we (and by we I mean @rafaelfranca) did once was wrapping up several spriteful calls into a bash script that generated each sprite with a different command and different options to match the desired file structure. There is the obvious performance hit for the multiple ruby processes but so far has been quite acceptable.

Does this might sound like a solution for your scenario?

eshiota commented 10 years ago

@lucasmazza Yeah, that's what I've been doing until now. Just wanted to know if you had any plans of implementing a neater solution. :cat:

lucasmazza commented 10 years ago

Yeah, I want to add some kind of support for multiple configurations, but it's not that high on my todo list :runner: