benhoIIand / grunt-sprite-generator

Grunt task that generates a sprite from images referenced in a stylesheet and then updates the references with the new sprite image and positions
Other
18 stars 9 forks source link

baseUrl is not replaceable #9

Open davidpelayo opened 10 years ago

davidpelayo commented 10 years ago

I'm trying to set my own baseUrl path in order to generate outputs relative to a certain URL, but it doesn't work.

When you modify the baseUrl as an option in the grunt configuration object from outside (not the plugin JS file), instead, the configuragion object in the Gruntfile.js, paths are processed wrongly, not being able to execute the task properly.

Following the next example:

spriteGenerator: {
      options: {
        algorithm: 'binary-tree',
        baseUrl: './app/',
        padding: 0
      },
      default_task: {
        files: {
          'app/images/sprites.png': ['css/main.css']
        }
      }
    },

If you console.log the files array in "spriteGenerator.js", the reference of src files are lost.

davidpelayo commented 10 years ago

I pressume is an issue with Grunt files management, right? http://gruntjs.com/configuring-tasks#options