-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: dest.on is not a function #142
Comments
There's a lot going on in this script. Can you remove anything not related to I believe the following version should do that: var gulp = require('gulp')
var spritesmith = require('gulp.spritesmith');
var source = "./testorig/"
var dest = "./test/"
gulp.task('sprites', function () {
var files = gulp.src(source+'/*.png')
// Short version:
var spriteData = files
.pipe(spritesmith({
imgName: 'sprite.png',
cssName: 'sprite.css'
}));
// We need to return our stream to `gulp` so it knows when the task is done
return spriteData.pipe(gulp.dest(dest));
}); |
Thanks for your reply. The image and the css is saved properly if I don't try to pass it to imagemin.
|
It sounds like the vinyl-buffer syntax has changed. Can you check their
README for preferred usage?
This could be a different require due to an ES6 export or maybe they expect
options now
Another way to resolve it might be jumping back in major versions for
vinyl-buffer but it's prob best to figure out what's new with the latest
…On Sat, Feb 16, 2019, 2:58 PM Jeremy ***@***.*** wrote:
Thanks for your reply.
Well not that much, it's the recommended way on the readme, to use the
buffer() thing, but I get an error.
The image and the css is saved properly if I don't try to pass it to
imagemin.
var imgStream = spriteData.img
.pipe(buffer())
.pipe(imagemin({ // < ----- Error line
progressive: true,
interlaced: true,
optimizationLevel: 7,
svgoPlugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}],
plugins: [
pngquant({
quality: [70,90],
speed: 1
})
]
}))
.pipe(gulp.dest(dest));
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA3FWMsI84iNVDJNGNvRpiEpK3iqp0PVks5vOI0PgaJpZM4a--zW>
.
|
I checked but they releases 1.0.1 a year ago... and the syntax seems fine to me. If you have a moment could you check to confirm this? |
Ah, I see the issue. You're using var imagemin = require('imagemin');
// Should be
var imagemin = require('gulp-imagemin'); For reference, we do provide the README examples in https://github.com/twolfson/gulp.spritesmith/blob/6.9.0/docs/gulpfile.js#L23-L44 |
Oh damn! I'm very sorry, I didn't notice that at all in all the time I spent trying to make it work. Thanks! |
I am having trouble using this module.
Script:
Trace:
Versions:
The text was updated successfully, but these errors were encountered: