Thursday, March 6, 2014

Task 'default' was not defined in your gulpfile but you tried to run it Please check the documentation for proper gulpfile formatting.

Task 'default' was not defined in your gulpfile but you tried to run it Please check the documentation for proper gulpfile formatting.
This error happened when I was trying to minify a CSS file which was including @media tags ,I was trying to minify this file using Notepad++  Jstool plugin through JsMin command, but the this function cannot handle @media queries the right way and the output file will not maintain @media queries properly and the final Css file will be useless. So to solve this issue I had to install gulp and its gulp-minify-css plugin because  But when I created the gulpfile like this :

 
var gulp = require('gulp');
var minifyCSS = require('gulp-minify-css');
gulp.task('minify-css', function() {

  gulp.src('styles.css')
    .pipe(minifyCSS())
    .pipe(gulp.dest('./'));
});



 and tried to run the command :

gulp


I got the above mentioned error ,So I thought the problem because I didn't add the file name to the command :

gulp gulpfile.js 


 but that also didn't solve the issue. again and again I check the file for syntax errors but didn't find thing.

The problem as very dummy . It is because I didn't add the task name to the command line :

gulp  minify-css



That's it . thank you.


No comments:

Post a Comment