mardi 3 novembre 2015

Gulp watch not respoding correctly

I am new to using node.js and gulp and I have this specific problem. I've installed gulp globally and locally to be sure, edited the gulp file in the project but it doesn't seem to load for some reason. It displays "task watch is not in your gulpfile" wherever I type "gulp watch". Here is how I edited the file itself, thanks for your help in advance.

    /**
   * Gulp Configuration
   *
   * We are using [gulp](http://gulpjs.com/) as a build system.
   */

   var gulp         = require( "gulp" ),
sass         = require( "gulp-sass" ),
autoprefixer = require( "gulp-autoprefixer" ),
connect      = require( "gulp-connect" ),
gutil        = require( "gulp-util" ),
es           = require( 'event-stream' ),
del          = require( "del" );

/**
 * Clean Task
 */
 gulp.task( "clean", function() {
  return del( ["./.build/**"] );
  } );

  /**
  * Stylesheets Task
  */
  gulp.task( "stylesheets", function() {
   return gulp
    .src( "./stylesheets/**/*.scss" )
    .pipe( sass().on( "error", sass.logError ) )
    .pipe( autoprefixer( { browsers : ["last 2 versions"] } ) )
    .pipe( gulp.dest( "./.build/stylesheets" ) )
    .pipe( connect.reload() )
    .on( "error", gutil.log );
 } );

 /**
  * Assets Task
  */
    gulp.task( "assets", function() {
    return es.merge(
    gulp.src( "./images/**/*" )
        .pipe( gulp.dest( "./.build/images" ) ),
    gulp.src( "./fonts/**/*" )
        .pipe( gulp.dest( "./.build/fonts" ) )
     );
     } );

    /**
      * HTML
      */
     gulp.task( "html", function() {
     return gulp
    .src( "./html/**/*" )
    .pipe( gulp.dest( "./.build" ) );
    } );

   /**
     * Development
     */
     gulp.task( "development", function() {

/** Development Server */
connect.server( {
    port : 8080,
    root : "./.build/",
    livereload : true
} );

/** Watch any changes */
gulp.watch( "./stylesheets/**/*.scss", ["stylesheets"] );

/** Watch any html changes */
gulp.watch( "./html/**/*.html", ["html"] );

 } );

 /**
   * Build task alias
  */
 gulp.task( "build", ['stylesheets', 'assets', 'html'] );

Aucun commentaire:

Enregistrer un commentaire