<commit_before>var gulp       = require('gulp');  
var babel = require('gulp-babel'); 
var less       = require('gulp-less');
var watch      = require('gulp-watch');
var cssnano = require('gulp-cssnano'); 
var sourcemaps = require('gulp-sourcemaps');
var rename     = require('gulp-rename');  
var header     = require('gulp-header');  
var pkg        = require('./package.json');
var autoprefixer = require('gulp-autoprefixer');


var watchify = require('watchify');
var babelify    = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var assign = require('lodash.assign');


/* Prepare banner text */
var banner = ['/**',  
  ' * <%= pkg.name %> v<%= pkg.version %>',
  ' * <%= pkg.description %>',
  ' * <%= pkg.author.name %>',
  ' */',
  ''].join('\n');

/* Task to compile less */
gulp.task('compile-less', function() {  
  gulp.src('./css/styles.less', { base: 'src' })
    .pipe(sourcemaps.init())
    .pipe(less())
    .pipe(header(banner, {pkg: pkg}))
    .pipe(sourcemaps.write()) // put sourcemap in generated css file
    // .pipe(sourcemaps.write(".")) // put sourcemap in it's own file
    .pipe(gulp.dest('./css/'));
});

gulp.task('babel', function() {
	return gulp.src('src/portfolio.js')
		.pipe(sourcemaps.init())
		.pipe(babel({
			presets: ['react']
		}))
		.pipe(sourcemaps.write("."))
		.pipe(gulp.dest('build'));
});


/* Task to watch less changes */
gulp.task('watch-less', function() {  
  gulp.watch('./css/*.less' , ['compile-less']);
  gulp.watch('./css/styles.css' , ['autoprefixer']);
  gulp.watch('./src/*.js' , ['babel']);
});


gulp.task('autoprefixer', function () {
    return gulp.src('css/styles.css')
        // .pipe(sourcemaps.init())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        // .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('./dist/'));
});


/* Task to minify css */
gulp.task('minify-css', function() {  
  gulp.src('./css/styles.css')
  	.pipe(sourcemaps.init())
    .pipe(cssnano())
    .pipe(header(banner, {pkg: pkg}))
    .pipe(rename('styles.min.css'))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest( './css/dist/' ));
});


// add custom browserify options here<commit_msg>update gulp file so that autoprefixer is handled at the same time as less build so that the souremaps work correctly<commit_after>var gulp       = require('gulp');  
var babel = require('gulp-babel'); 
var less       = require('gulp-less');
var watch      = require('gulp-watch');
var cssnano = require('gulp-cssnano'); 
var sourcemaps = require('gulp-sourcemaps');
var rename     = require('gulp-rename');  
var header     = require('gulp-header');  
var pkg        = require('./package.json');
var autoprefixer = require('gulp-autoprefixer');


var watchify = require('watchify');
var babelify    = require('babelify');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var assign = require('lodash.assign');


/* Prepare banner text */
var banner = ['/**',  
  ' * <%= pkg.name %> v<%= pkg.version %>',
  ' * <%= pkg.description %>',
  ' * <%= pkg.author.name %>',
  ' */',
  ''].join('\n');

/* Task to compile less */
gulp.task('compile-less', function() {  
  gulp.src('./css/styles.less', { base: 'src' })
    .pipe(sourcemaps.init())
    .pipe(less())
    .pipe(header(banner, {pkg: pkg}))
    .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
    .pipe(sourcemaps.write()) // put sourcemap in generated css file
    // .pipe(sourcemaps.write(".")) // put sourcemap in it's own file
    .pipe(gulp.dest('./css/'));
});

gulp.task('babel', function() {
	return gulp.src('src/portfolio.js')
		.pipe(sourcemaps.init())
		.pipe(babel({
			presets: ['react']
		}))
		.pipe(sourcemaps.write("."))
		.pipe(gulp.dest('build'));
});


/* Task to watch less changes */
gulp.task('watch-less', function() {  
  gulp.watch('./css/*.less' , ['compile-less']);
  // gulp.watch('./css/styles.css' , ['autoprefixer']);
  gulp.watch('./src/*.js' , ['babel']);
});


gulp.task('autoprefixer', function () {
    return gulp.src('css/styles.css')
        .pipe(sourcemaps.init())
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('./dist/'));
});


/* Task to minify css */
gulp.task('minify-css', function() {  
  gulp.src('./css/styles.css')
  	.pipe(sourcemaps.init())
    .pipe(cssnano())
    .pipe(header(banner, {pkg: pkg}))
    .pipe(rename('styles.min.css'))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest( './css/dist/' ));
});


// add custom browserify options here
{'fraction_non_alphanumeric': 0.21850112313661427, 'fraction_numerical': 0.000612619971411068, 'mean_word_length': 3.1194280908326326, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5340653', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1667, 'n_words': 324}