N
N
nurise2014-03-20 22:57:52
npm
nurise, 2014-03-20 22:57:52

How to properly configure Gulp?

Installed modules gulp, gulp-less in the project folder. *.less files in less folder, *.css - in css

// Gulp
var less = require('gulp-less');
var gulp = require('gulp');

gulp.task('less', function () {
  gulp.src('less/*.less')
    .pipe(less())
    .pipe(gulp.dest('css'));
});

I wrote in package.json
"scripts": {
    "build": "npm run gulp-less"
  },

I call npm run build
Files are not compiled.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Velichko, 2014-07-27
@Zoxon

var gulp = require('gulp'),
    less = require('gulp-less'),
    gutil = require('gulp-util');

handleError = function(err) {
    gutil.log(err);
    gutil.beep();
};

gulp.task('less', function() {
    gulp.src('./less/*.less')
        .pipe(less())
        .on('error', handleError)
        .pipe(gulp.dest('./css'))
});

gulp.task("watch", function() {
    gulp.watch('less/**/*.less', ['less']);
});


gulp.task("build", ['less']);

gulp.task("default", ["build", "watch"]);

You need to put gulp globally
then put all the dependencies
it just starts
gulp

A
Alexey Karunos, 2014-04-15
@alkaruno

gulp less

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question