twolfson / gulp.spritesmith

Convert a set of images into a spritesheet and CSS variables via gulp
The Unlicense
1.08k stars 81 forks source link

Can not create a sprite image #85

Closed muratdogan17 closed 8 years ago

muratdogan17 commented 8 years ago

I'm trying to create a sprite file, I've tried so many task cases here is the one of them :

gulp.task('sprite:build',function() { var spriteData = gulp.src(path.src.imgSprite) .pipe(spritesmith({ imgName: 'icons-sprite.png', cssName: 'icons-sprite.scss', imgPath: path.build.imgSprite + 'icons-sprite.png' })); console.log('output folder : ' + path.build.imgSprite); return (spriteData.pipe(gulp.dest(path.build.imgSprite))); });

It doesn't create any file. neither css nor img file.

twolfson commented 8 years ago

It sounds like there are no images being found by gulp.src. Can you verify path.src.imgSprite is correct?

https://github.com/twolfson/gulp.spritesmith/blob/6.2.1/lib/gulp-spritesmith.js#L108-L112

muratdogan17 commented 8 years ago

here is my gulpfile : http://jsbin.com/rizaqoyise/edit?js the directory is really exists 

7 Nis 2016 20:41 Perşembe tarihinde Todd Wolfson <notifications@github.com> şöyle yazdı:

Closed #85.— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

twolfson commented 8 years ago

Everything looks fine, I suggest using gulp-debug to verify the input files are being found:

https://www.npmjs.com/package/gulp-debug

muratdogan17 commented 8 years ago

Here is the output after I've implemented gulp-debug :  [10:12:23] Using gulpfile C:\Bitbucket\jumanji\Jumanji.Assets\Gulpfile.js [10:12:23] Starting 'sprites'... [10:12:23] Finished 'sprites' after 33 ms [10:12:23] files: Static\src\img\sprite-icons\ico-arrow-down-black.png [10:12:23] files: Static\src\img\sprite-icons\ico-arrow-left-black.png [10:12:23] files: Static\src\img\sprite-icons\ico-close-white.png [10:12:23] files: Static\src\img\sprite-icons\ico-horoscope-capricon.png [10:12:23] files: Static\src\img\sprite-icons\ico-search.png [10:12:23] files: Static\src\img\sprite-icons\ico-social-account.png [10:12:23] files: Static\src\img\sprite-icons\retina\ico-arrow-down-black@2x.png [10:12:23] files: 7 itemsProcess terminated with code 0. Here is the task :  gulp.task('sprites', function () {        gulp.src('Static/src/img/sprite-icons//._')        .pipe(debug({ title: 'files:' }))        .pipe(spritesmith({            cssName: 'sprites.scss', // CSS file            imgName: 'sprites.png' // Image file        }))        .pipe(gulpif('.png', gulp.dest('Static/dist/img/sprite')))        .pipe(gulpif('.scss', gulp.dest('Static/dist/img/sprite')))    }); I still have same issue :(

9 Nis 2016 7:25 Cumartesi tarihinde Todd Wolfson <notifications@github.com> şöyle yazdı:

Everything looks fine, I suggest using gulp-debug to verify the input files are being found:https://www.npmjs.com/package/gulp-debug— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

twolfson commented 8 years ago

In the latest task, it's missing a return so gulp doesn't know to wait for the pipe to finish before exiting. Here's a fixed task:

gulp.task('sprites', function () {
    return gulp.src('Static/src/img/sprite-icons/**/*.*')
        .pipe(debug({ title: 'files:' }))
        .pipe(spritesmith({
            cssName: '_sprites.scss', // CSS file            
            imgName: 'sprites.png' // Image file
        }))
        .pipe(gulpif('*.png', gulp.dest('Static/dist/img/sprite')))
        .pipe(gulpif('*.scss', gulp.dest('Static/dist/img/sprite')))
});
muratdogan17 commented 8 years ago

It is still a nightmare :/  here is its output :  [10:11:41] Using gulpfile C:\Bitbucket\jumanji\Jumanji.Assets\Gulpfile.js[10:11:41] Starting 'sprites'...[10:11:41] files: Static\src\img\sprite-icons\ico-arrow-down-black.png[10:11:41] files: Static\src\img\sprite-icons\ico-arrow-left-black.png[10:11:41] files: Static\src\img\sprite-icons\retina\ico-arrow-down-black@2x.png[10:11:42] files: 7 items Process terminated with code 0.

12 Nis 2016 1:13 Salı tarihinde Todd Wolfson <notifications@github.com> şöyle yazdı:

In the latest task, it's missing a return so gulp doesn't know to wait for the pipe to finish before exiting. Here's a fixed task:gulp.task('sprites', function () { return gulp.src('Static/src/img/sprite-icons//._') .pipe(debug({ title: 'files:' })) .pipe(spritesmith({ cssName: 'sprites.scss', // CSS file
imgName: 'sprites.png' // Image file })) .pipe(gulpif('
.png', gulp.dest('Static/dist/img/sprite'))) .pipe(gulpif('
.scss', gulp.dest('Static/dist/img/sprite'))) });— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

twolfson commented 8 years ago

It's possible there's an error in your images although the exit code should be non-zero. Can you try another image like:

https://github.com/twolfson/gulp.spritesmith/blob/6.2.1/test/test-files/sprite1.png

muratdogan17 commented 8 years ago

I need your help :(

12 Nis 2016 10:14 Salı tarihinde Murat Dogan <muratdogan@yahoo.com> şöyle yazdı:

It is still a nightmare :/  here is its output :  [10:11:41] Using gulpfile C:\Bitbucket\jumanji\Jumanji.Assets\Gulpfile.js[10:11:41] Starting 'sprites'...[10:11:41] files: Static\src\img\sprite-icons\ico-arrow-down-black.png[10:11:41] files: Static\src\img\sprite-icons\ico-arrow-left-black.png[10:11:41] files: Static\src\img\sprite-icons\retina\ico-arrow-down-black@2x.png[10:11:42] files: 7 items Process terminated with code 0.

12 Nis 2016 1:13 Salı tarihinde Todd Wolfson <notifications@github.com> şöyle yazdı:

In the latest task, it's missing a return so gulp doesn't know to wait for the pipe to finish before exiting. Here's a fixed task:gulp.task('sprites', function () { return gulp.src('Static/src/img/sprite-icons//._') .pipe(debug({ title: 'files:' })) .pipe(spritesmith({ cssName: 'sprites.scss', // CSS file
imgName: 'sprites.png' // Image file })) .pipe(gulpif('
.png', gulp.dest('Static/dist/img/sprite'))) .pipe(gulpif('
.scss', gulp.dest('Static/dist/img/sprite'))) });— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

twolfson commented 8 years ago

I'm trying to help you. My last comment was to establish a program that we know works (sanity check). What was the result of using 1 of our images as your gulp.src?