mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-22 03:34:14 +00:00
fix(spritesmith): add background-size property to all sprites. Fixes https://github.com/HabitRPG/habitrpg/issues/2510 , see https://github.com/Ensighten/grunt-spritesmith/issues/67
This commit is contained in:
parent
5fc920356a
commit
1223294267
5 changed files with 2006 additions and 10 deletions
19
Gruntfile.js
19
Gruntfile.js
|
|
@ -21,6 +21,7 @@ module.exports = function(grunt) {
|
|||
destImg: 'dist/spritesmith.png',
|
||||
destCSS: 'dist/customizer.css',
|
||||
algorithm: 'binary-tree',
|
||||
cssTemplate: 'css/css.template.mustache',
|
||||
cssVarMap: function (sprite) {
|
||||
// `sprite` has `name`, `image` (full path), `x`, `y`
|
||||
// `width`, `height`, `total_width`, `total_height`
|
||||
|
|
@ -34,24 +35,24 @@ module.exports = function(grunt) {
|
|||
}
|
||||
if (~sprite.name.indexOf('shirt'))
|
||||
sprite.y = sprite.y+15; // even more for shirts
|
||||
},
|
||||
cssOpts: {
|
||||
'cssClass': function (item) {
|
||||
}
|
||||
/*,cssOpts: {
|
||||
cssClass: function (item) {
|
||||
return '.' + item.name;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
},
|
||||
main: {
|
||||
src: 'img/sprites/spritesmith/**/*.png',
|
||||
destImg: 'dist/spritesmith.png',
|
||||
destCSS: 'dist/spritesmith.css',
|
||||
algorithm: 'binary-tree',
|
||||
cssOpts: {
|
||||
'cssClass': function (item) {
|
||||
//return '.sprite-' + item.name;
|
||||
return '.' + item.name;
|
||||
cssTemplate: 'css/css.template.mustache'
|
||||
/*,cssOpts: {
|
||||
cssClass: function (item) {
|
||||
return '.' + item.name; //'.sprite-' + item.name;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
9
css/css.template.mustache
Normal file
9
css/css.template.mustache
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{{#items}}
|
||||
.{{name}} {
|
||||
background-image: url({{{escaped_image}}});
|
||||
background-position: {{px.offset_x}} {{px.offset_y}};
|
||||
width: {{px.width}};
|
||||
height: {{px.height}};
|
||||
background-size: {{px.total_width}} {{px.total_height}};
|
||||
}
|
||||
{{/items}}
|
||||
993
dist/customizer.css
vendored
993
dist/customizer.css
vendored
File diff suppressed because it is too large
Load diff
2
dist/habitrpg-shared.css
vendored
2
dist/habitrpg-shared.css
vendored
File diff suppressed because one or more lines are too long
993
dist/spritesmith.css
vendored
993
dist/spritesmith.css
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue