twolfson / grunt-spritesmith

Grunt task for converting a set of images into a spritesheet and corresponding CSS variables
MIT License
1.14k stars 92 forks source link

Generated spritesheet not overwriting previous #110

Closed bdelaney closed 9 years ago

bdelaney commented 9 years ago

I have looked at issues 96 and 97. I am using two totally separate source and destination folders. I simply wanted to change the padding value, and did this in my grunt task. The task runs successfully, but the old spritesheet is never replaced. I change the task to write to a new dest sheet. That works, new one is created. The old one had been checked into my local Git repo. Perhaps that is locking the file and explains why it is not overwritten. I'm removing it from Git commit. ... Retesting now and have reproduced the issue. The task runs, reports that the css and png files are both created. BUT, only the css file is overwritten. The png file just stays the same. This is true even when I change the option for padding. The sprite png file is NOT rewritten.

twolfson commented 9 years ago

Can you paste in your sprite config from your Gruntfile? Also, can you paste the output from the grunt task you are running (preferrably with a --verbose flag)?

bdelaney commented 9 years ago
    sprite: {
        all: {
            src: 'assets/images/sprites/*.png',
            dest: 'wwwroot/images/spritesheet.png',
            destCss: 'wwwroot/css/sprites.css',
            padding: 1
        }
    }

verbose output:

Command-line options: --verbose

Reading "gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Initializing config...OK

Registering "grunt-bower-task" local Npm module tasks.
Reading C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-bower-task\package.json...OK
Parsing C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-bower-task\package.json...OK
Loading "bower_task.js" tasks...OK
+ bower

Registering "grunt-sass" local Npm module tasks.
Reading C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-sass\package.json...OK
Parsing C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-sass\package.json...OK
Loading "sass.js" tasks...OK
+ sass

Registering "grunt-contrib-watch" local Npm module tasks.
Reading C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-contrib-watch\package.json...OK
Parsing C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-contrib-watch\package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-spritesmith" local Npm module tasks.
Reading C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-spritesmith\package.json...OK
Parsing C:\Users\Bill\Source\Repos\WIP Website\WIPdemo1\src\WIPdemo1\node_module
s\grunt-spritesmith\package.json...OK
Loading "grunt-spritesmith.js" tasks...OK
+ sprite
Loading "gruntfile.js" tasks...OK
+ default

Running tasks: sprite

Running "sprite" task

Running "sprite:all" (sprite) task
Verifying property sprite.all exists in config...OK
Files: assets/images/sprites/Silatronix.png, assets/images/sprites/TrackIf.png,
assets/images/sprites/aquamost.png, assets/images/sprites/aver.png, assets/image
s/sprites/belbrook.png, assets/images/sprites/bioionix.png, assets/images/sprite
s/cellectar.png, assets/images/sprites/conjugon.png, assets/images/sprites/cpac.
png, assets/images/sprites/deltanoid.png, assets/images/sprites/fhg.png, assets/
images/sprites/harqen.png, assets/images/sprites/hopster.png, assets/images/spri
tes/invenra.png, assets/images/sprites/kiio.png, assets/images/sprites/lucigen.p
ng, assets/images/sprites/lumec.png, assets/images/sprites/murfie.png, assets/im
ages/sprites/mvi.png, assets/images/sprites/neoclone.png, assets/images/sprites/
nerites.png, assets/images/sprites/npoint.png, assets/images/sprites/optmine.png
, assets/images/sprites/p2si.png, assets/images/sprites/phoenix_nuclear.png, ass
ets/images/sprites/pinpoint.png, assets/images/sprites/quintessence.png, assets/
images/sprites/renovar.png, assets/images/sprites/shine.png, assets/images/sprit
es/snowshoe.png, assets/images/sprites/solomo.png, assets/images/sprites/stemina
.png, assets/images/sprites/stratatech.png, assets/images/sprites/swallow.png, a
ssets/images/sprites/termsync.png, assets/images/sprites/virent.png, assets/imag
es/sprites/xolve.png, assets/images/sprites/zurex.png -> wwwroot/images/spritesh
eet.png
Files "wwwroot/css/sprites.css", "wwwroot/images/spritesheet.png" created.

Done, without errors.
twolfson commented 9 years ago

Hm, that is very strange indeed. I have a bunch of questions:

bdelaney commented 9 years ago

Darn, OOPs. I just noticed something. I add a new image and ran the task. The spritesheet IS updated. I was going by the 'created date' in my file system listing. Never even noticed that the modified date IS changed. Totally my problem for not inspecting the 'revised' spritesheet more carefully. Sorry...

twolfson commented 9 years ago

Heh, no worries. Glad it wasn't a deeper issue =)