<commit_before>'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var pug = require('gulp-pug');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');

/**
 * Default
 */
gulp.task('default', ['sass', 'pug', 'babel']);

gulp.task('watch', ['sass:watch', 'pug:watch', 'babel:watch']);

gulp.task('min', ['sass:min', 'babel:min']);

/**
 * Sass
 */
gulp.task('sass', function () {
	return gulp.src('src/sass/style.scss')
		.pipe(sourcemaps.init())
		.pipe(sass().on('error', sass.logError))
		.pipe(sourcemaps.write('./'))
		.pipe(gulp.dest('dist/css/'));
});

gulp.task('sass:watch', function () {
	gulp.watch('src/sass/**/*.scss', ['sass']);
});

gulp.task('sass:min', function () {
	return gulp.src('src/sass/style.scss')
		.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
		.pipe(rename('style.min.css'))
		.pipe(gulp.dest('dist/css/'));
});

/**
 * Pug
 */
gulp.task('pug', function () {
	return gulp.src('tests/views/*.pug')
		.pipe(pug({
			// options.
			pretty: true,
		}))
		.pipe(gulp.dest('tests/'));
});

gulp.task('pug:watch', function () {
	gulp.watch('tests/views/**/*.pug', ['pug']);
});

/**
 * Babel
 */
var jsOption = {
	fileName: 'script.js',
	minFileName: 'script.min.js',
	srcDir: './src/js/',
	dest: './dist/js/',
	baseList: require('./src/js/cosmos.json'),
	customList: require('./src/js/custom.json')
};
var jsFiles = (function () {
	var list = jsOption.baseList.concat(jsOption.customList);
	list.forEach(function (v, i, a) {
		a[i] = jsOption.srcDir + v;
	});
	return list;
})();

gulp.task('babel', function () {
	return gulp.src(jsFiles)
		.pipe(sourcemaps.init())
		.pipe(babel({
			presets: ["es2015"]
		}))
		.pipe(concat(jsOption.fileName))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest(jsOption.dest));
});

gulp.task('babel:watch', function () {
	gulp.watch('src/js/**/*.js', ['babel']);
});

gulp.task('babel:min', function () {
	return gulp.src(jsFiles)
		.pipe(babel({
			presets: ["es2015"]
		}))
		.pipe(concat(jsOption.minFileName))
		.pipe(uglify())
		.pipe(gulp.dest(jsOption.dest));
});<commit_msg>Modify gulpfile.js<commit_after>'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var pug = require('gulp-pug');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var babel = require('gulp-babel');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');

/************************************************************
	Config
*************************************************************
*	
*/
var config = {
	// sass
	sassSrc: './src/sass/style.scss',
	sassDest: './dist/css/',
	cssFile: 'style.css',
	cssMinFile: 'style.min.css',
	// js
	jsSrcDir: './src/js/',
	jsBase: require('./src/js/cosmos.json'),
	jsCustom: require('./src/js/custom.json'),
	jsDest: './dist/js/',
	jsFile: 'script.js',
	jsMinFile: 'script.min.js',
};
var jsSources = (function () {
	var list = config.jsBase.concat(config.jsCustom);
	list.forEach(function (v, i, a) {
		a[i] = config.jsSrcDir + v;
	});
	return list;
})();


/************************************************************
	Tasks
*************************************************************
*	
*/

/**
 * Default
 */
gulp.task('default', ['sass', 'pug', 'babel']);

gulp.task('watch', ['sass:watch', 'pug:watch', 'babel:watch']);

gulp.task('min', ['sass:min', 'babel:min']);

/**
 * Sass
 */
gulp.task('sass', function () {
	return gulp.src(config.sassSrc)
		.pipe(sourcemaps.init())
		.pipe(sass().on('error', sass.logError))
		.pipe(rename(config.cssFile))
		.pipe(sourcemaps.write('./'))
		.pipe(gulp.dest(config.sassDest));
});

gulp.task('sass:watch', function () {
	gulp.watch('src/sass/**/*.scss', ['sass']);
});

gulp.task('sass:min', function () {
	return gulp.src(config.sassSrc)
		.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
		.pipe(rename(config.cssMinFile))
		.pipe(gulp.dest(config.sassDest));
});

/**
 * Pug
 */
gulp.task('pug', function () {
	return gulp.src('tests/views/*.pug')
		.pipe(pug({
			// options.
			pretty: true,
		}))
		.pipe(gulp.dest('tests/'));
});

gulp.task('pug:watch', function () {
	gulp.watch('tests/views/**/*.pug', ['pug']);
});

/**
 * Babel
 */
gulp.task('babel', function () {
	return gulp.src(jsSources)
		.pipe(sourcemaps.init())
		.pipe(babel({
			presets: ["es2015"]
		}))
		.pipe(concat(config.jsFile))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest(config.jsDest));
});

gulp.task('babel:watch', function () {
	gulp.watch('src/js/**/*.js', ['babel']);
});

gulp.task('babel:min', function () {
	return gulp.src(jsSources)
		.pipe(babel({
			presets: ["es2015"]
		}))
		.pipe(concat(config.jsMinFile))
		.pipe(uglify())
		.pipe(gulp.dest(config.jsDest));
});
{'fraction_non_alphanumeric': 0.2906666666666667, 'fraction_numerical': 0.003282051282051282, 'mean_word_length': 4.534619750283769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1395534', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1888, 'n_words': 274}