<commit_before>/* global config, path, project */

module.exports = function(grunt) {
	grunt.registerTask('buildStyle', function() {
		var less = grunt.file.read(config.paths.wee + 'style/wee.less'),
			buildFiles = grunt.file.expand({
				cwd: config.paths.cssSource + 'build'
			}, [
				'**/*.css',
				'**/*.less'
			]),
			imports = [],
			inject = '';

		buildFiles.forEach(function(name) {
			name = '@{sourcePath}/build/' +
				name.replace(path.normalize(config.paths.assets), '');

			if (name.indexOf('/vendor/') !== -1) {
				imports.unshift(name);
			} else {
				imports.push(name);
			}
		});

		// Build configured
		var buildArray = [
			'<%= config.paths.cssSource %>build/**/*.{css,less}'
		];

		project.style.build.forEach(function(name) {
			name = Wee.buildPath(config.paths.cssSource, name);

			buildArray.push(name);

			name = '@{sourcePath}/' +
				name.replace(path.normalize(config.paths.assets), '');

			imports.push(name);
		});

		grunt.config.set('watch.styleBuildUpdate.files', buildArray);

		// Merge imports into global imports
		config.style.imports = config.style.imports.concat(imports);

		// Process template
		config.style.imports.forEach(function(val) {
			if (path.extname(val) === '.css') {
				inject += '@import (inline) "' + val + '";\n';
			} else {
				inject += '@import "' + val + '";\n';
			}
		});

		less = less.replace('{{imports}}', inject)
			.replace('{{print}}', config.style.print)
			.replace('{{responsive}}', config.style.responsive);

		// Write temporary file
		grunt.file.write(config.paths.weeTemp, less);

		// Add to concat array
		config.style.concat.push(config.paths.temp + 'wee.css');

		// Run Grunt tasks
		var tasks = [
			'less:lib',
			'less:core'
		];

		tasks = tasks.concat(config.style.tasks);
		tasks.push('concat:style');
<commit_msg>Add optional flag to compile scripts to avoid compilation race issues<commit_after>/* global config, path, project */

module.exports = function(grunt) {
	grunt.registerTask('buildStyle', function() {
		var less = grunt.file.read(config.paths.wee + 'style/wee.less'),
			buildFiles = grunt.file.expand({
				cwd: config.paths.cssSource + 'build'
			}, [
				'**/*.css',
				'**/*.less'
			]),
			imports = [],
			inject = '';

		buildFiles.forEach(function(name) {
			name = '@{sourcePath}/build/' +
				name.replace(path.normalize(config.paths.assets), '');

			if (name.indexOf('/vendor/') !== -1) {
				imports.unshift(name);
			} else {
				imports.push(name);
			}
		});

		// Build configured
		var buildArray = [
			'<%= config.paths.cssSource %>build/**/*.{css,less}'
		];

		project.style.build.forEach(function(name) {
			name = Wee.buildPath(config.paths.cssSource, name);

			buildArray.push(name);

			name = '@{sourcePath}/' +
				name.replace(path.normalize(config.paths.assets), '');

			imports.push(name);
		});

		grunt.config.set('watch.styleBuildUpdate.files', buildArray);

		// Merge imports into global imports
		config.style.imports = config.style.imports.concat(imports);

		// Process template
		config.style.imports.forEach(function(val) {
			if (path.extname(val) === '.css') {
				inject += '@import (inline, optional) "' + val + '";\n';
			} else {
				inject += '@import (optional) "' + val + '";\n';
			}
		});

		less = less.replace('{{imports}}', inject)
			.replace('{{print}}', config.style.print)
			.replace('{{responsive}}', config.style.responsive);

		// Write temporary file
		grunt.file.write(config.paths.weeTemp, less);

		// Add to concat array
		config.style.concat.push(config.paths.temp + 'wee.css');

		// Run Grunt tasks
		var tasks = [
			'less:lib',
			'less:core'
		];

		tasks = tasks.concat(config.style.tasks);
		tasks.push('concat:style');

{'fraction_non_alphanumeric': 0.19645256651437787, 'fraction_numerical': 0.0005374899220639613, 'mean_word_length': 3.312862108922364, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7429772', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1267, 'n_words': 212}