【问题标题】:Is there grunt tasks for generating images sprites according by css?是否有根据 css 生成图像精灵的繁重任务?
【发布时间】:2013-03-29 11:34:14
【问题描述】:

假设我有以下 style.css 文件:

h1 {
  padding: 10px;
  background: url('/img/header.png');
}
p {
   background: url('/img/p.png');
}

我需要自动为这个 css 制作图像精灵。我需要得到这样的东西:

h1 {
  padding: 10px;
  background: url('/img/sprite.png') -47px 0;
}
p {
   background: url('/img/sprite.png') -130px 0;
}

是否可以使用 grunt task 自动制作?

【问题讨论】:

    标签: css sprite gruntjs


    【解决方案1】:

    您似乎正在寻找这个grunt-sprite-generator。来自文档:

    Grunt 任务,从样式表中引用的图像生成精灵,然后使用新的精灵图像和位置更新引用

    另一个看起来符合要求的工具是grunt-spritesmith

    【讨论】:

      【解决方案2】:

      Grunt Imagine怎么样?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-10-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-27
        相关资源
        最近更新 更多