Answer the question
In order to leave comments, you need to log in
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/'));
});
Answer the question
In order to leave comments, you need to log in
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
return gulp.src('assets/css/*.css')
.pipe(sourcemaps.init())
.pipe(postcss([ autoprefixer({ browsers: ['last 2 version'] }) ]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dest'));
});
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 questionAsk a Question
731 491 924 answers to any question