S
S
sashavol2015-12-31 13:16:10
Less
sashavol, 2015-12-31 13:16:10

Building Gulp with prefix?

Good afternoon and everyone!
The question has been tormenting for a very long time, it is not critical, but it would make life much easier, no matter how much I tried to add autoprefixer in my assembly, it did not work.
UPD.: By the way, everything is fine on the grant.
Here is my gulpfile:

"use sctrict";

var gulp = require("gulp"),
    connect = require("gulp-connect"),
    less = require('gulp-less'), 
    opn = require("opn");

// Запускаем локальный сервер
gulp.task('connect', function() {
  connect.server({
    root: 'app',
    livereload: true,
    port: 8888
  });
  opn('http://localhost:8888');
});

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

// Работа с HTML
gulp.task('html', function () {
  gulp.src('app/*.html')
    .pipe(connect.reload());
});

// Работа с CSS
gulp.task('css', function () {
  gulp.src('app/css/*.css')    
    .pipe(connect.reload());
});

// Работа с JS
gulp.task('js', function () {
  gulp.src('app/js/*.js')
    .pipe(connect.reload());
});

// Слежка
gulp.task('watch', function () {
  gulp.watch(['app/*.html'], ['html']);
  gulp.watch(['app/js/*.js'], ['js']);
  gulp.watch(['app/css/*.css'], ['css']);
  gulp.watch(['app/less/*.less'], ['less']);
});

// Задача по-умолчанию
gulp.task('default', ['connect', 'watch']);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Korolev, 2015-12-31
@sashavol

First option: gulp-autoprefixer. Implementation example - https://github.com/MUSTdigital/md-base/blob/master...
The second option is the same autoprefixer, but through PostCSS. Example - https://github.com/ApatheticG/breakpoint-less/blob...
It's not entirely clear, do you have a build task in principle? Prefix injection is usually needed already at this stage, it is not practical to do it every time when compiling LESS. But if you really want to, then your galpfile may look like this: https://gist.github.com/ApatheticG/b830a0b11c4e42d7f616
Only two lines have been added. And don't forget to install gulp-autoprefixer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question