title: Using Gulp to Minify and Auto Update a CSS File
body: <p>I have a Gulp task that minifies my CSS in one folder and then pipes it to another folder.  </p>
  
  <pre><code>const gulp = require("gulp");
  const cleanCSS = require("gulp-clean-css");
  
  gulp.task("minify-css", () =&gt; {
    return (
      gulp
        .src("./css/**/*.css")
        .pipe(cleanCSS())
        .pipe(gulp.dest("minified"))
    );
  });
  </code></pre>
  
  <p>The command <code>gulp minify-css</code> works perfectly.  I don't want to have to continually type that command in the terminal tho.</p>
  
  <p>I want the code below to watch my CSS file and when it changes I want the <code>minify-css</code> task to run and update my minified file but it doesn't work:</p>
  
  <pre><code>gulp.task("default", function(evt) {
    gulp.watch("./css/**/*.css", function(evt) {
      gulp.task("minify-css");
    });
  });
  </code></pre>
  
  <p>Any ideas on why this doesn't work?  Thank you in advance!</p>