D
D
Dmitry Katyushin2015-04-08 20:03:45
JavaScript
Dmitry Katyushin, 2015-04-08 20:03:45

Can you help with Gulp?

Hello. I decided to build the project using Gulp (before that I did everything manually and everything suited me, but I have to move on), I try to do everything according to the description, and after writing the "ready" code and running it, an error comes out, here is the gulpfile.js code :

var gulp = require('gulp'),
sass = require('gulp-sass'),
compass = require('gulp-compass'),
autoprefixer = require('autoprefixer-core'),
imagemin = require('gulp-imagemin'),
pngquant = require('imagemin-pngquant'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
htmlmin = require('gulp-htmlmin'),
concat = require('gulp-concat');

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

gulp.task('compass', function() {
  gulp.src('assets/scss/*.scss')
    .pipe(compass({
      config_file: './config.rb',
      css: 'stylesheets',
      sass: 'sass'
    }))
    .pipe(gulp.dest('assets/scss'));
});

return gulp.src('assets/css/*.css')
        .pipe(sourcemaps.init())
        .pipe(postcss([ autoprefixer({ browsers: ['last 2 version'] }) ]))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('./dest'));
});

gulp.task('default', function () {
    return gulp.src('assets/img/*')
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        .pipe(gulp.dest('assets/img'));
});

gulp.task('default', function() {
    return gulp.src('assets/*.css')
        .pipe(csso())
        .pipe(gulp.dest('assets/css/out'));
});

gulp.task('compress', function() {
  return gulp.src('assets/js/*.js')
    .pipe(uglify())
    .pipe(gulp.dest('assets/js'));
});

gulp.task('minify', function() {
  return gulp.src('*.html')
    .pipe(htmlmin({collapseWhitespace: true}))
    .pipe(gulp.dest('dist'))
});

gulp.task('scripts', function() {
  return gulp.src('assets/js/*.js')
    .pipe(concat('all.js'))
    .pipe(gulp.dest('dist/'));
});

This came out:
0f5dce1f6c8d4b17bd2a3b77977bb166.png
Thank you in advance for your help and responsiveness :)
UPD: Error at the very end, added more }); does not work, what should I do, what should be the end?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
IceJOKER, 2015-04-08
@IceJOKER

You were given full information there, what an error. on which line of which file the .
gulpfile.js line 68 extra curly brace or something like that

S
Sergey, 2015-04-08
Protko @Fesor

return gulp.src('assets/css/*.css')
        .pipe(sourcemaps.init())
        .pipe(postcss([ autoprefixer({ browsers: ['last 2 version'] }) ]))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('./dest'));
});

there is clearly a missing line... something like gulp.task

A
Alexander Zachinalov, 2015-04-08
@SanDiesel

Something you do not finish ... Where is the build task that you are trying to execute?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question