node.js - sprity的gulp插件margin设置问题?
PHPz
PHPz 2017-04-17 13:57:14
0
1
581

插件地址:sprites

gulp.task('sprites', function() {
    return sprity.src({
            src: './src/images/icon/**/*.{png,jpg}',
            style: './_icon.scss',
            margin: 20,
            orientation: 'left-right',
            processor: 'css',
        })
        .pipe(gulpif('*.png', gulp.dest('./src/images/'), gulp.dest('./src/sass/')))
});

配置了margin:20 生成的background-position位置会不准,设置成margin:0能正常。

PHPz
PHPz

学习是最好的投资!

reply all(1)
PHPzhong
{{#each layouts}}
  {{#each sprites}}

    {{#if dpi}}
    @media (-webkit-min-device-pixel-ratio: {{ratio}}), (min-resolution: {{dpi}}dpi) {
    {{/if}}
    .icon {
      background-image: url('{{escimage url}}');
      {{#if dpi}}
      background-size: {{width}} {{height}};
      {{/if}}
    }
    {{#if dpi}}
    }
    {{/if}}
  {{/each}}

  {{#each layout.items}}
  .{{../classname}}-{{meta.name}} {
    background-position: (-{{x}}px - 20) (-{{y}}px - 20);
    width: ({{width}}px - 40);
    height: ({{height}}px - 40);
  }
  {{/each}}
{{/each}}

It’s normal after adding this. It seems that you need to configure the .hbs template

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template