Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoprefixer is not working with high volume of css #111

Open
edudix opened this issue May 13, 2019 · 0 comments
Open

Autoprefixer is not working with high volume of css #111

edudix opened this issue May 13, 2019 · 0 comments

Comments

@edudix
Copy link

edudix commented May 13, 2019

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']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant