sindresorhus / gulp-autoprefixer

Prefix CSS
MIT License
694 stars 50 forks source link

Autoprefixer is not working with high volume of css #111

Open edudix opened 5 years ago

edudix commented 5 years ago

Hello, I have a problem with autoprefixer which I´m not able to solve. I´m using gulp, gulp sass and others. Please take a look to my code. The problem is with a high volume of CSS code lines. I tested it with a few of them and it´s working perfectly. But not with a complete project. Could someone help me?

const gulp          = require('gulp');
const sass          = require('gulp-sass');
const autoprefixer  = require('gulp-autoprefixer');
const sourcemaps    = require('gulp-sourcemaps');
const cleanCSS      = require('gulp-clean-css');
const pump          = require('pump');
const uglify        = require('gulp-uglify');

//File Paths
const STYLE_PATH = 'assets/sass/style.scss'; //Style.scss path.
const SCRIPTS_PATH = 'assets/js/*.js'; //Scripts path.
const DEST_PATH = './';
const SCSS_PATH = 'assets/sass/**/*.scss';
const DIST_PATH = 'assets/dist';

///Prefixer test
gulp.task('prefix', () =>
    gulp.src('styleTest.css')
        .pipe(autoprefixer({browsers: ['last 99 versions'],cascade: false}))
    .pipe(gulp.dest(DIST_PATH))
);

//Styles for SCSS
gulp.task('styles', function(){
    console.log(`Starting style tasks!`);
    return gulp.src(STYLE_PATH)
        .pipe(sourcemaps.init())
        .pipe(sass({
            includedPaths: ['sass']
        }))
        .pipe(autoprefixer({browsers: ['last 10 versions']}))
        .pipe(cleanCSS())
        .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest(DEST_PATH));
});

//Scripts
gulp.task('scripts', function(cb) {
    console.log('scripts are running') //type gulp scripts at the terminal
    pump([
        gulp.src(SCRIPTS_PATH)
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(sourcemaps.write()),
        gulp.dest(DIST_PATH)
    ],
    cb
  );
});

//Default
gulp.task('default', ['styles', 'scripts'], function(){
    console.log(`Default are running`);
});

//Watch Execution
gulp.task('watch', ['default'], function(){
    console.log(`Watch is running`);
    gulp.watch(SCRIPTS_PATH, ['scripts']);
    gulp.watch(SCSS_PATH, ['styles']);
});