Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNatasha McDiarmid
11,400 PointsHow to minify css via gulp?
I have this in my gulpfile.js. I have also installed the package BTW.
var cleanCSS = require('gulp-clean-css');
gulp.task('cleanCSS', function(){
return gulp.src('wp-content/themes/theme-name/style.css')
.pipe(cleanCSS())
.pipe(gulp.dest('wp-content/themes/theme-name/style.css'))
});
When I run gulp
, it doesn't minify my css. What am I doing wrong?
1 Answer
Natasha McDiarmid
11,400 PointsI figured it out. I forgot to add 'cleanCSS' to my default task.
gulp.task('default', ['sass','watch','cleanCSS']);