Skip to content

options.pathSeparator

Eugene Lazutkin edited this page Mar 18, 2014 · 1 revision

Type: String

Default value: '_'

A string value that is used as a replacement for path separator symbols like / or \ depending on user's platform.

A sister option options.dotSeparator governs the substitution of dots.

Examples

All examples below assume following source files:

images/x16/tool.png
images/x32/tool.png

Example #1

Default configuration:

grunt.initConfig({
  tight_sprite: {
    icons: {
      options: {
        hide: "images/"
      },
      src: ["images/**/*.png"],
      dest: "images/icons.png"
    }
  }
})

The generated CSS files will include following CSS classes:

.sprite_x16_tool ...
.sprite_x32_tool ...

'sprite_' is a default CSS class prefix. The rest comes from source file names, where path separators are replaced with underscores.

Example #2

With an alternative path separator:

grunt.initConfig({
  tight_sprite: {
    icons: {
      options: {
        classPrefix: "sprite-",
        pathSeparator: "-",
        hide: "images/"
      },
      src: ["images/**/*.png"],
      dest: "images/icons.png"
    }
  }
})

The generated CSS files will include following CSS classes:

.sprite-x16-tool ...
.sprite-x32-tool ...