{
  // 默认选项
  'functions': true,
  'variableNameTransforms': ['dasherize']
}

{{#block "sprites-comment"}}
/*
LESS变量关于图标编译状态的信息，存储在原始文件名下

.icon-home {
  width: @icon-home-width;
}

以下是单个图标包含的所有信息变量
@icon-home: x y offset_x offset_y width height total_width total_height image_path name;

以下这块，我们提供了它的雪碧图样式信息
@spritesheet: width height image @spritesheet-sprites;
*/
{{/block}}
{{#block "sprites"}}
{{#each sprites}}
@{{strings.name_name}}: '{{name}}';
@{{strings.name_x}}: {{px.x}};
@{{strings.name_y}}: {{px.y}};
@{{strings.name_offset_x}}: {{px.offset_x}};
@{{strings.name_offset_y}}: {{px.offset_y}};
@{{strings.name_width}}: {{px.width}};
@{{strings.name_height}}: {{px.height}};
@{{strings.name_total_width}}: {{px.total_width}};
@{{strings.name_total_height}}: {{px.total_height}};
@{{strings.name_image}}: '{{{escaped_image}}}';
@{{strings.name}}: {{px.x}} {{px.y}} {{px.offset_x}} {{px.offset_y}} {{px.width}} {{px.height}} {{px.total_width}} {{px.total_height}} '{{{escaped_image}}}' '{{name}}';
{{/each}}
{{/block}}
{{#block "spritesheet"}}
@{{spritesheet_info.strings.name_width}}: {{spritesheet.px.width}};
@{{spritesheet_info.strings.name_height}}: {{spritesheet.px.height}};
@{{spritesheet_info.strings.name_image}}: '{{{spritesheet.escaped_image}}}';
@{{spritesheet_info.strings.name_sprites}}:{{#each sprites}} @{{strings.name}}{{/each}};
@{{spritesheet_info.strings.name}}: {{spritesheet.px.width}} {{spritesheet.px.height}} '{{{spritesheet.escaped_image}}}' @{{spritesheet_info.strings.name_sprites}};
{{/block}}

{{#block "sprite-functions-comment"}}
{{#if options.functions}}
/*
假如预期使用于数组变量

.icon-home {
  .sprite-width(@icon-home);
}
.icon-email {
  .sprite(@icon-email);
}

举个html使用的例子：

`display: block` sprite:
<div class="icon-home"></div>

改变`display`(比如`display: inline-block;`),我们建议用来做公用css样式：

// CSS
.icon {
  display: inline-block;
}

// HTML
<i class="icon icon-home"></i>
*/
{{/if}}
{{/block}}
{{#block "sprite-functions"}}
{{#if options.functions}}
.sprite-width(@sprite) {
  width: extract(@sprite, 5);
}

.sprite-height(@sprite) {
  height: extract(@sprite, 6);
}

.sprite-position(@sprite) {
  @sprite-offset-x: extract(@sprite, 3);
  @sprite-offset-y: extract(@sprite, 4);
  background-position: @sprite-offset-x @sprite-offset-y;
}

.sprite-image(@sprite) {
  {{! DEV: We slice to trim off excess quotes on an escaped URL }}
  @sprite-image: extract(@sprite, 9);
  @sprite-image-bare: ~`"@{sprite-image}".slice(1, -1)`;
  background-image: url(@sprite-image-bare);
  background-size: extract(@sprite, 7) extract(@sprite, 8);
}

.sprite(@sprite) {
  .sprite-image(@sprite);
  .sprite-position(@sprite);
  .sprite-width(@sprite);
  .sprite-height(@sprite);
}
{{/if}}
{{/block}}

{{#block "spritesheet-functions-comment"}}
{{#if options.functions}}
/*
这个`.sprites`方法通常输出完全相同的css模版
但是可以覆盖在less里

一定要运行的时候，你至少要有2个sprites
如果只运行单个sprite，会有参考错误

.sprites(@spritesheet-sprites);
*/
{{/if}}
{{/block}}
{{#block "spritesheet-functions"}}
{{#if options.functions}}
.sprites(@sprites, @i: 1) when (@i <= length(@sprites)) {
  @sprite: extract(@sprites, @i);
  @sprite-name: e(extract(@sprite, 10));
  .@{sprite-name} {
    .sprite(@sprite);
  }
  .sprites(@sprites, @i + 1);
}
{{/if}}
{{/block}}


/*
依次列出所有预设icon
 */
{{#block "spritesIcon"}}
{{#each sprites}}
{{{selector}}} {
  background-image: url({{{escaped_image}}});
  background-size: {{px.total_width}} {{px.total_height}};
  background-position: {{px.offset_x}} {{px.offset_y}};
  width: {{px.width}};
  height: {{px.height}};
}
{{/each}}
{{/block}}
