<commit_before>var gulp = require('gulp'),
	path = require('path');

var to5 = require('gulp-6to5'),
	monic = require('gulp-monic'),
	gcc = require('gulp-closure-compiler'),
	rename = require('gulp-rename'),
	header = require('gulp-header'),
	replace = require('gulp-replace'),
	wrap = require('gulp-wrap'),
	bump = require('gulp-bump'),
	download = require('gulp-download'),
	istanbul = require('gulp-istanbul'),
	jasmine = require('gulp-jasmine'),
	eol = require('gulp-eol'),
	run = require('gulp-run');

function getVersion() {
	delete require.cache[require.resolve('./lib/core')];
	return require('./lib/core').VERSION.join('.');
}

function getBuilds() {
	delete require.cache[require.resolve('./builds')];
	return Object(require('./builds'));
}

gulp.task('yaspeller', function () {
	run('node node_modules/yaspeller/bin/cli.js ./').exec();
});

gulp.task('pub', function () {
	gulp.src('./bin/*.js')
		.pipe(eol('\n'))
		.pipe(gulp.dest('./bin'))
		.on('end', function () {
			run('npm pub').exec(undefined, function () {
				gulp.src('./bin/*.js')
					.pipe(eol())
					.pipe(gulp.dest('./bin'));
			});
		});
});

gulp.task('build', function (callback) {
	var builds = getBuilds(),
		i = 0;

	for (var key in builds) {
		if (!builds.hasOwnProperty(key)) {
			continue;
		}

		i++;
		var fullHead =
			'/*!\n' +
			' * Snakeskin v' + getVersion() + (key !== 'snakeskin' ? ' (' + key.replace(/^snakeskin\./, '') + ')' : '') + '\n' +
			' * https://github.com/kobezzza/Snakeskin\n' +
			' *\n' +
			' * Released under the MIT license\n' +
			' * https://github.com/kobezzza/Snakeskin/blob/master/LICENSE\n' +
			' *\n' +
			' * Date: ' + new Date().toUTCString() + '\n' +
			' */\n\n';

		gulp.src('./lib/core.js')
			.pipe(monic({
				flags: builds[key]
			}))

			.pipe(to5({
				blacklist: [
					'minification.propertyLiterals',
					'minification.memberExpressionLiterals',
					'useStrict'
				],

				optional: [
					'spec.undefinedToVoid'
				]
			}))

			.pipe(wrap(
				'(function () {' +
					'\n' +
					'\'use strict\';' +
					'\n' +
					'var self = this;' +
					'\n' +
					'<%= contents %>' +
					'\n' +
				'}).call(new Function(\'return this\')());'
			))

			.pipe(replace(/\/\/\/\/#include/g, '//#include'))
			.pipe(monic())

			// Fix for @param {foo} [bar=1] -> @param {foo} [bar]
			.pipe(replace(/(@param {.*?}) \[([$\w.]+)=.*]/g, '$1 $2'))

			// Whitespaces in strings of templates
			.pipe(replace(/\/\* cbws \*\/"[\s\S]*?[^\\"]";?(?:$|[}]+$|[)]+;?$)/gm, function (sstr) {
				return sstr
					.replace(/\\n|\\t/g, '')
					.replace(/\\[\r\n]/g, ' ');
			}))

			.pipe(header(fullHead))
			.pipe(rename(key + '.js'))
			.pipe(eol())
			.pipe(gulp.dest('./dist/'))

			.on('end', function () {
				i--;

				if (!i) {
					callback();
				}
			});
	}
});

gulp.task('predefs', ['build'], function (callback) {
	download([
		'https://raw.githubusercontent.com/google/closure-compiler/master/externs/fileapi.js',
		'https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jasmine.js'
	])
		.pipe(eol())
		.pipe(gulp.dest('./predefs/src/ws'))
		.on('end', function () {
			gulp.src('./predefs/src/index.js')
				.pipe(monic())
				.pipe(gulp.dest('./predefs/build'))
				.on('end', callback);
		});
});

gulp.task('test', ['predefs'], function (callback) {
	gulp.src('./dist/snakeskin.js')
		.pipe(istanbul())
		.pipe(istanbul.hookRequire())
		.on('finish', function () {
			gulp.src(['./test/test.dev.js'])
				.pipe(jasmine())
				.pipe(istanbul.writeReports())
				.on('end', callback);
		});
});

function compile(dev) {
	return function (callback) {
		var builds = getBuilds(),
			i = 0;

		for (var key in builds) {
			if (!builds.hasOwnProperty(key)) {
				continue;
			}

			i++;
			var params = {
				compilerPath: './bower_components/closure-compiler/compiler.jar',
				fileName: key + '.min.js',
				compilerFlags: {
					compilation_level: 'ADVANCED_OPTIMIZATIONS',
					use_types_for_optimization: null,
					language_in: 'ES5',
					externs: [
						'./predefs/build/index.js'
					],

					jscomp_off: [
						'nonStandardJsDocs'
					]
				}
			};

			if (dev) {
				params.compilerFlags.jscomp_warning = [
					'invalidCasts',
					'accessControls',
					'checkDebuggerStatement',
					'checkRegExp',
					'checkTypes',
					'const',
					'constantProperty',
					'deprecated',
					'externsValidation',
					'missingProperties',
					'visibility',
					'missingReturn',
					'duplicate',
					'internetExplorerChecks',
					'suspiciousCode',
					'uselessCode',
					'misplacedTypeAnnotation',
					'typeInvalidation'
				];
			}

			gulp.src(path.join('./dist/', key + '.js'))
				.pipe(gcc(params))
				.pipe(header('/*! Snakeskin v' + getVersion() + (key !== 'snakeskin' ? ' (' + key.replace(/^snakeskin\./, '') + ')' : '') + ' | https://github.com/kobezzza/Snakeskin/blob/master/LICENSE */\n'))
				.pipe(replace(/\(function\(.*?\)\{/, '$&\'use strict\';'))
				.pipe(eol())
				.pipe(gulp.dest('./dist/'))
				.on('end', function () {
					i--;

					if (!i) {
						callback.apply(this, arguments);
					}
				});
		}
	}
}

gulp.task('compile', ['test'], compile());
gulp.task('compile-dev', ['test'], compile(true));

gulp.task('bump', function () {
	gulp.src('./*.json')
		.pipe(bump({version: getVersion()}))
		.pipe(eol())
		.pipe(gulp.dest('./'));
});

gulp.task('watch', function () {
	gulp.watch('./lib/**/*.js', ['build']);
	gulp.watch('./lib/core.js', ['bump']);
});

gulp.task('default', ['compile', 'bump']);
<commit_msg>Replaced 6to5 to Babel; Updated pub task<commit_after>var gulp = require('gulp'),
	path = require('path');

var to5 = require('gulp-babel'),
	monic = require('gulp-monic'),
	gcc = require('gulp-closure-compiler'),
	rename = require('gulp-rename'),
	header = require('gulp-header'),
	replace = require('gulp-replace'),
	wrap = require('gulp-wrap'),
	bump = require('gulp-bump'),
	download = require('gulp-download'),
	istanbul = require('gulp-istanbul'),
	jasmine = require('gulp-jasmine'),
	eol = require('gulp-eol'),
	run = require('gulp-run');

function getVersion() {
	delete require.cache[require.resolve('./lib/core')];
	return require('./lib/core').VERSION.join('.');
}

function getBuilds() {
	delete require.cache[require.resolve('./builds')];
	return Object(require('./builds'));
}

gulp.task('yaspeller', function () {
	run('node node_modules/yaspeller/bin/cli.js ./').exec();
});

gulp.task('pub', function () {
	gulp.src('./bin/*.js')
		.pipe(eol('\n'))
		.pipe(gulp.dest('./bin'))
		.on('end', function () {
			run('npm pub && bower register snakeskin https://github.com/kobezzza/Snakeskin').exec(undefined, function () {
				gulp.src('./bin/*.js')
					.pipe(eol())
					.pipe(gulp.dest('./bin'));
			});
		});
});

gulp.task('build', function (callback) {
	var builds = getBuilds(),
		i = 0;

	for (var key in builds) {
		if (!builds.hasOwnProperty(key)) {
			continue;
		}

		i++;
		var fullHead =
			'/*!\n' +
			' * Snakeskin v' + getVersion() + (key !== 'snakeskin' ? ' (' + key.replace(/^snakeskin\./, '') + ')' : '') + '\n' +
			' * https://github.com/kobezzza/Snakeskin\n' +
			' *\n' +
			' * Released under the MIT license\n' +
			' * https://github.com/kobezzza/Snakeskin/blob/master/LICENSE\n' +
			' *\n' +
			' * Date: ' + new Date().toUTCString() + '\n' +
			' */\n\n';

		gulp.src('./lib/core.js')
			.pipe(monic({
				flags: builds[key]
			}))

			.pipe(to5({
				blacklist: [
					'es3.propertyLiterals',
					'es3.memberExpressionLiterals',
					'useStrict'
				],

				optional: [
					'spec.undefinedToVoid'
				]
			}))

			.pipe(wrap(
				'(function () {' +
					'\n' +
					'\'use strict\';' +
					'\n' +
					'var self = this;' +
					'\n' +
					'<%= contents %>' +
					'\n' +
				'}).call(new Function(\'return this\')());'
			))

			.pipe(replace(/\/\/\/\/#include/g, '//#include'))
			.pipe(monic())

			// Fix for @param {foo} [bar=1] -> @param {foo} [bar]
			.pipe(replace(/(@param {.*?}) \[([$\w.]+)=.*]/g, '$1 $2'))

			// Whitespaces in strings of templates
			.pipe(replace(/\/\* cbws \*\/"[\s\S]*?[^\\"]";?(?:$|[}]+$|[)]+;?$)/gm, function (sstr) {
				return sstr
					.replace(/\\n|\\t/g, '')
					.replace(/\\[\r\n]/g, ' ');
			}))

			.pipe(header(fullHead))
			.pipe(rename(key + '.js'))
			.pipe(eol())
			.pipe(gulp.dest('./dist/'))

			.on('end', function () {
				i--;

				if (!i) {
					callback();
				}
			});
	}
});

gulp.task('predefs', ['build'], function (callback) {
	download([
		'https://raw.githubusercontent.com/google/closure-compiler/master/externs/fileapi.js',
		'https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jasmine.js'
	])
		.pipe(eol())
		.pipe(gulp.dest('./predefs/src/ws'))
		.on('end', function () {
			gulp.src('./predefs/src/index.js')
				.pipe(monic())
				.pipe(gulp.dest('./predefs/build'))
				.on('end', callback);
		});
});

gulp.task('test', ['predefs'], function (callback) {
	gulp.src('./dist/snakeskin.js')
		.pipe(istanbul())
		.pipe(istanbul.hookRequire())
		.on('finish', function () {
			gulp.src(['./test/test.dev.js'])
				.pipe(jasmine())
				.pipe(istanbul.writeReports())
				.on('end', callback);
		});
});

function compile(dev) {
	return function (callback) {
		var builds = getBuilds(),
			i = 0;

		for (var key in builds) {
			if (!builds.hasOwnProperty(key)) {
				continue;
			}

			i++;
			var params = {
				compilerPath: './bower_components/closure-compiler/compiler.jar',
				fileName: key + '.min.js',
				compilerFlags: {
					compilation_level: 'ADVANCED_OPTIMIZATIONS',
					use_types_for_optimization: null,
					language_in: 'ES5',
					externs: [
						'./predefs/build/index.js'
					],

					jscomp_off: [
						'nonStandardJsDocs'
					]
				}
			};

			if (dev) {
				params.compilerFlags.jscomp_warning = [
					'invalidCasts',
					'accessControls',
					'checkDebuggerStatement',
					'checkRegExp',
					'checkTypes',
					'const',
					'constantProperty',
					'deprecated',
					'externsValidation',
					'missingProperties',
					'visibility',
					'missingReturn',
					'duplicate',
					'internetExplorerChecks',
					'suspiciousCode',
					'uselessCode',
					'misplacedTypeAnnotation',
					'typeInvalidation'
				];
			}

			gulp.src(path.join('./dist/', key + '.js'))
				.pipe(gcc(params))
				.pipe(header('/*! Snakeskin v' + getVersion() + (key !== 'snakeskin' ? ' (' + key.replace(/^snakeskin\./, '') + ')' : '') + ' | https://github.com/kobezzza/Snakeskin/blob/master/LICENSE */\n'))
				.pipe(replace(/\(function\(.*?\)\{/, '$&\'use strict\';'))
				.pipe(eol())
				.pipe(gulp.dest('./dist/'))
				.on('end', function () {
					i--;

					if (!i) {
						callback.apply(this, arguments);
					}
				});
		}
	}
}

gulp.task('compile', ['test'], compile());
gulp.task('compile-dev', ['test'], compile(true));

gulp.task('bump', function () {
	gulp.src('./*.json')
		.pipe(bump({version: getVersion()}))
		.pipe(eol())
		.pipe(gulp.dest('./'));
});

gulp.task('watch', function () {
	gulp.watch('./lib/**/*.js', ['build']);
	gulp.watch('./lib/core.js', ['bump']);
});

gulp.task('default', ['compile', 'bump']);
<|endoftext|>


<commit_before>'use strict';

var gulp         = require('gulp');
var sass         = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var rename       = require('gulp-rename');
var uglify       = require('gulp-uglify');
var jshint       = require('gulp-jshint');
var stylish      = require('jshint-stylish');
var gcmq         = require('gulp-group-css-media-queries');

// Some costants
var dest = './dist';
var destJS = './dist/js';
var destCSS = './dist/css';
var files = {
    js: 'src/js/*.js',
    scss: 'src/scss/*.scss'
};

gulp.task('sass', function() {
    gulp.src(files.scss)
        .pipe(sass({outputStyle: 'expanded'}))
        .pipe(autoprefixer(['last 2 versions']))
        .pipe(gcmq())
        .pipe(gulp.dest(destCSS));
});

gulp.task('lint', function() {
    return gulp.src(files.js)
        .pipe(jshint())
        .pipe(jshint.reporter(stylish));
});

gulp.task('compress', function() {
    return gulp.src(files.js)
        .pipe(uglify())
        .pipe(rename({extname: '.min.js'}))
        .pipe(gulp.dest(destJS));
});

gulp.task('default', ['sass', 'lint', 'compress']);
<commit_msg>added gulp watch task<commit_after>'use strict';

var gulp         = require('gulp');
var sass         = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var rename       = require('gulp-rename');
var uglify       = require('gulp-uglify');
var jshint       = require('gulp-jshint');
var stylish      = require('jshint-stylish');
var gcmq         = require('gulp-group-css-media-queries');

// Some costants
var dest = './dist';
var destJS = './dist/js';
var destCSS = './dist/css';
var files = {
    js: 'src/js/*.js',
    scss: 'src/scss/*.scss'
};

gulp.task('sass', function() {
    gulp.src(files.scss)
        .pipe(sass({outputStyle: 'expanded'}))
        .pipe(autoprefixer(['last 2 versions']))
        .pipe(gcmq())
        .pipe(gulp.dest(destCSS));
});

gulp.task('lint', function() {
    return gulp.src(files.js)
        .pipe(jshint())
        .pipe(jshint.reporter(stylish));
});

gulp.task('compress', function() {
    return gulp.src(files.js)
        .pipe(uglify())
        .pipe(rename({extname: '.min.js'}))
        .pipe(gulp.dest(destJS));
});

gulp.task('default', ['sass', 'lint', 'compress']);

gulp.task('watch', function () {
  gulp.watch(files.js, ['lint']);
  gulp.watch(files.js, ['compress']);
  gulp.watch(files.scss);
});
<|endoftext|>


<commit_before>'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var filesize = require('gulp-filesize');
var minifyCss = require('gulp-minify-css');
var plumber = require('gulp-plumber');
var jslint = require('gulp-jslint');

gulp.task('sass', function () {
    gulp.src('./src/WebRobot/FreelanceBundle/Resources/assets/sass/**/*.scss')
        .pipe(plumber())
        .pipe(filesize())
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(gulp.dest('./src/WebRobot/FreelanceBundle/Resources/public/css'))
        .pipe(filesize());
});

gulp.task('js', function () {
    gulp.src('./src/WebRobot/FreelanceBundle/Resources/assets/js/**/*.js')
        .pipe(plumber())
        .pipe(filesize())
        .pipe(jslint({
            node: true,
            reporter: 'default'
        }))
        .pipe(gulp.dest('./src/WebRobot/FreelanceBundle/Resources/public/js'))

});

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

gulp.task('default', ['sass', 'js']);<commit_msg>Remove sass:watch task and replace by default<commit_after>'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var filesize = require('gulp-filesize');
var minifyCss = require('gulp-minify-css');
var plumber = require('gulp-plumber');
var jslint = require('gulp-jslint');

gulp.task('sass', function () {
    gulp.src('./src/WebRobot/FreelanceBundle/Resources/assets/sass/**/*.scss')
        .pipe(plumber())
        .pipe(filesize())
        .pipe(sass().on('error', sass.logError))
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(minifyCss({compatibility: 'ie8'}))
        .pipe(gulp.dest('./src/WebRobot/FreelanceBundle/Resources/public/css'))
        .pipe(filesize());
});

gulp.task('js', function () {
    gulp.src('./src/WebRobot/FreelanceBundle/Resources/assets/js/**/*.js')
        .pipe(plumber())
        .pipe(filesize())
        .pipe(jslint({
            node: true,
            reporter: 'default'
        }))
        .pipe(gulp.dest('./src/WebRobot/FreelanceBundle/Resources/public/js'))

});

gulp.task('default',function() {
    gulp.watch('./src/WebRobot/FreelanceBundle/Resources/assets/sass/*.scss',['sass', 'js']);
});<|endoftext|>


<commit_before>// include gulp

var gulp = require('gulp');

// Include plugins

var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');

// concatenate files

gulp.task('scripts', function () {
    return gulp.src('app/src/js/*.js')
        .pipe(concat('main.js'))
        .pipe(rename({suffix:'.min'}))
        .pipe(uglify())
        .pipe(gulp.dest('build/js'));
});

gulp.task('sass',function () {
    return sass('app/src/scss/style.sass', {style:'compressed'})
        .pipe(rename({suffix:'.min'}))
        .pipe(gulp.dest('build/css'));
});

gulp.task('watch',function () {
    gulp.watch('app/src/js/*.js',['scripts']);

    gulp.watch('app/src/scss/*.scss',['sass']);
})

// default task

gulp.task('default',['scripts', 'watch']);<commit_msg>testing<commit_after>// include gulp

var gulp = require('gulp');

// Include plugins

var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');

// concatenate files

gulp.task('scripts', function () {
    return gulp.src('app/src/js/*.js')
        .pipe(concat('main.js'))
        .pipe(rename({suffix:'.min'}))
        .pipe(uglify())
        .pipe(gulp.dest('build/js'));
});

gulp.task('sass',function () {
    return sass('app/src/scss/style.sass', {style:'compressed'})
        .pipe(rename({suffix:'.min'}))
        .pipe(gulp.dest('build/css'));
});

gulp.task('watch',function () {
    gulp.watch('app/src/js/*.js',['scripts']);

    gulp.watch('app/src/scss/*.scss',['sass']);
})

// default task

gulp.task('default',['scripts','sass', 'watch']);<|endoftext|>


<commit_before>var gulp = require('gulp'),
	uglify = require('gulp-uglify'),
	rename = require('gulp-rename'),
	minifyCSS = require('gulp-minify-css'),
	plumber = require('gulp-plumber'),
	inline = require('gulp-inline'),
	minifyHTML = require('gulp-minify-html')

// Paths to various files
var paths = {
    scripts: ['dev/js/*.js'],
    styles: ['dev/css/*.css'],
    content: ['dev/index.html', 'dev/project-2048.html',
    	'dev/project-mobile.html', 'dev/project-webperf.html'],
    optScripts: ['dev/views/js/*.js'],
    optStyles: ['dev/views/css/*.css'],
    optContent: ['dev/views/opt.html']
};

/* Minifies our opt HTML files and outputs them to prod/*.html */
gulp.task('optHTML', function() {
    return gulp.src(paths.optContent)
        .pipe(inline({
    	base: paths.optContent,
    	js: uglify,
    	css: minifyCSS,
    	disabledTypes: ['svg', 'img']
        }))
        .pipe(minifyHTML({ empty: true }))
		.pipe(gulp.dest('prod/views/'));
});

/* Minifies our JS files and outputs them to prod/views/js */
gulp.task('scripts', function(){
	/*look for any file that has javascript & css in filename*/
	gulp.src(paths.scripts)
		/* still run watch task even if error in code */
		.pipe(plumber())
		/* minify the file */
		.pipe(uglify())
		/* rename the file */
		.pipe(rename('perfmatters.min.js'))
		.pipe(plumber.stop())
		/*save destination for minified file*/
		.pipe(gulp.dest('prod/js/'));
});

/* Minifies our opt JS files and outputs them to prod/views/js */
gulp.task('optJS', function(){
	/*look for any file that has javascript & css in filename*/
	gulp.src(paths.optScripts)
		/* still run watch task even if error in code */
		.pipe(plumber())
		/*minify the file*/
		.pipe(uglify())
		/*rename the file*/
		.pipe(rename('main.min.js'))
		.pipe(plumber.stop())
		/*save destination for minified file*/
		.pipe(gulp.dest('prod/views/js/'));
});

/* Minifies our HTML files and outputs them to prod/*.html */
gulp.task('content', function() {
	return gulp.src(paths.content)
    	.pipe(inline({
    	base: paths.content,
    	js: uglify,
    	css: minifyCSS,
    	disabledTypes: ['svg', 'img'],
    	ignore: ['dev/js/perfmatters.js', 'http://www.google-analytics.com/analytics.js']
        }))
        .pipe(minifyHTML({ empty: true }))
		.pipe(gulp.dest('prod/'));
});

/* Minifies CSS files */
gulp.task('styles', function (){
	gulp.src(paths.styles)
		.pipe(minifyCSS())
		.pipe(gulp.dest('prod/css/'));

});

/* Minifies opt CSS files */
gulp.task('optCSS', function (){
	gulp.src(paths.optStyles)
		.pipe(minifyCSS())
		.pipe(gulp.dest('prod/views/css/'));

});

/* run gulp tasks in background when changes are made to file */
gulp.task('watch', function(){
	gulp.watch(paths.scripts, ['scripts']);
	gulp.watch(paths.styles, ['styles']);
	gulp.watch(paths.content, ['content']);
	gulp.watch(paths.optScripts, ['optJS']);
	gulp.watch(paths.optStyles, ['optCSS']);
	gulp.watch(paths.optContent ['optCSS']);
});

gulp.task('default', ['scripts', 'styles',
	'content', 'optCSS',
	'optHTML', 'optJS', 'watch']);<commit_msg>chore: unused tasks removed from gulpfile.js<commit_after>var gulp = require('gulp'),
	uglify = require('gulp-uglify'),
	rename = require('gulp-rename'),
	minifyCSS = require('gulp-minify-css'),
	plumber = require('gulp-plumber'),
	inline = require('gulp-inline'),
	minifyHTML = require('gulp-minify-html')

// Paths to various files
var paths = {
    scripts: ['dev/js/*.js'],
    styles: ['dev/css/*.css'],
    content: ['dev/index.html']
};

/* Minifies our JS files and outputs them to prod/views/js */
gulp.task('scripts', function(){
	/*look for any file that has javascript & css in filename*/
	gulp.src(paths.scripts)
		/* still run watch task even if error in code */
		.pipe(plumber())
		/* minify the file */
		.pipe(uglify())
		/* rename the file */
		.pipe(rename('neighborhood.min.js'))
		.pipe(plumber.stop())
		/*save destination for minified file*/
		.pipe(gulp.dest('prod/js/'));
});

/* Minifies our HTML files and outputs them to prod/*.html */
gulp.task('content', function() {
	return gulp.src(paths.content)
    	.pipe(inline({
    	base: paths.content,
    	js: uglify,
    	css: minifyCSS,
    	disabledTypes: ['svg', 'img'],
    	ignore: ['dev/js/scripts.js', 'http://www.google-analytics.com/analytics.js']
        }))
        .pipe(minifyHTML({ empty: true }))
		.pipe(gulp.dest('prod/'));
});

/* Minifies CSS files */
gulp.task('styles', function (){
	gulp.src(paths.styles)
		.pipe(minifyCSS())
		.pipe(gulp.dest('prod/css/'));

});

/* run gulp tasks in background when changes are made to file */
gulp.task('watch', function(){
	gulp.watch(paths.scripts, ['scripts']);
	gulp.watch(paths.styles, ['styles']);
	gulp.watch(paths.content, ['content']);
});

gulp.task('default', ['scripts', 'styles',
	'content', 'watch']);<|endoftext|>


<commit_before>/* -------------------------------------------------------------------------------------------------

Build Configuration
Contributors: Luan Gjokaj, Adam McKenna, Mehdi Rezaei, Sören Wrede, Saneef Ansari

-------------------------------------------------------------------------------------------------- */
const babel = require('gulp-babel');
const browserSync = require('browser-sync');
const concat = require('gulp-concat');
const connect = require('gulp-connect-php');
const del = require('del');
const fs = require('fs');
const gulp = require('gulp');
const gutil = require('gulp-util');
const imagemin = require('gulp-imagemin');
const inject = require('gulp-inject-string');
const partialimport = require('postcss-easy-import');
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const postCSSMixins = require('postcss-mixins');
const postcssPresetEnv = require('postcss-preset-env');
const remoteSrc = require('gulp-remote-src');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');
const unzip = require('gulp-unzip');
const zip = require('gulp-zip');

/* -------------------------------------------------------------------------------------------------
Theme Name
-------------------------------------------------------------------------------------------------- */
const themeName = 'wordpressify';

/* -------------------------------------------------------------------------------------------------
PostCSS Plugins
-------------------------------------------------------------------------------------------------- */
const pluginsDev = [
	partialimport,
	postCSSMixins,
	postcssPresetEnv({
		stage: 0,
		features: {
			'nesting-rules': true,
			'color-mod-function': true,
			'custom-media': true,
		},
	}),
];
const pluginsProd = [
	partialimport,
	postCSSMixins,
	postcssPresetEnv({
		stage: 0,
		features: {
			'nesting-rules': true,
			'color-mod-function': true,
			'custom-media': true,
		},
	}),
];

/* -------------------------------------------------------------------------------------------------
Header & Footer JavaScript Boundles
-------------------------------------------------------------------------------------------------- */
const headerJS = [
	'node_modules/jquery/dist/jquery.js',
	'node_modules/nprogress/nprogress.js',
	'node_modules/aos/dist/aos.js',
	'node_modules/isotope-layout/dist/isotope.pkgd.js',
];
const footerJS = ['src/js/**'];

/* -------------------------------------------------------------------------------------------------
Installation Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task('default');

gulp.task('cleanup', () => {
	del(['build/**']);
	del(['dist/**']);
});

gulp.task('download-wordpress', () => {
	remoteSrc(['latest.zip'], {
		base: 'https://wordpress.org/',
	}).pipe(gulp.dest('build/'));
});

gulp.task('setup', ['unzip-wordpress', 'copy-config']);

gulp.task('unzip-wordpress', () => {
	gulp
		.src('build/latest.zip')
		.pipe(unzip())
		.pipe(gulp.dest('build/'));
});

gulp.task('copy-config', () => {
	gulp
		.src('wp-config.php')
		.pipe(inject.after("define('DB_COLLATE', '');", "\ndefine('DISABLE_WP_CRON', true);"))
		.pipe(gulp.dest('build/wordpress'))
		.on('end', () => {
			gutil.beep();
			gutil.log(devServerReady);
			gutil.log(thankYou);
		});
});

gulp.task('disable-cron', () => {
	fs.readFile('./build/wordpress/wp-config.php', (err, data) => {
		if (err) {
			gutil.log(
				wpFy + ' - ' + warning + ' wp-config.php still missing... WP_CRON was not disabled!',
			);
		}
		if (data) {
			if (data.indexOf('DISABLE_WP_CRON') >= 0) {
				gutil.log('WP_CRON is already disabled!');
			} else {
				gulp
					.src('build/wordpress/wp-config.php')
					.pipe(inject.after("define('DB_COLLATE', '');", "\ndefine('DISABLE_WP_CRON', true);"))
					.pipe(gulp.dest('build/wordpress'));
			}
		}
	});
});

gulp.task('fresh-install', () => {
	del(['src/**']).then(() => {
		gulp.src('tools/fresh-theme/**').pipe(gulp.dest('src'));
	});
});

/* -------------------------------------------------------------------------------------------------
Development Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task(
	'build-dev',
	[
		'copy-theme-dev',
		'copy-fonts-dev',
		'style-dev',
		'header-scripts-dev',
		'footer-scripts-dev',
		'plugins-dev',
		'watch',
	],
	() => {
		connect.server(
			{
				base: 'build/wordpress',
				port: '3020',
			},
			() => {
				browserSync({
					logPrefix: wpFy,
					proxy: '127.0.0.1',
					host: '127.0.0.1',
					port: '3000',
					open: 'external'
				});
			},
		);
	},
);

gulp.task('copy-theme-dev', () => {
	if (!fs.existsSync('./build')) {
		gutil.log(buildNotFound);
		process.exit(1);
	} else {
		gulp.src('src/theme/**').pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName));
	}
});

gulp.task('copy-fonts-dev', () => {
	gulp
		.src('src/fonts/**')
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/fonts'));
});

gulp.task('style-dev', () => {
	return gulp
		.src('src/style/style.css')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(postcss(pluginsDev))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName))
		.pipe(browserSync.stream({ match: '**/*.css' }));
});

gulp.task('header-scripts-dev', () => {
	return gulp
		.src(headerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(concat('header-bundle.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/js'));
});

gulp.task('footer-scripts-dev', () => {
	return gulp
		.src(footerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(
			babel({
				presets: ['@babel/preset-env'],
			}),
		)
		.pipe(concat('footer-bundle.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/js'));
});

gulp.task('plugins-dev', () => {
	return gulp.src('src/plugins/**').pipe(gulp.dest('build/wordpress/wp-content/plugins'));
});

gulp.task('reload-js', ['footer-scripts-dev', 'header-scripts-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-fonts', ['copy-fonts-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-theme', ['copy-theme-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-plugins', ['plugins-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('watch', () => {
	gulp.watch(['src/style/**/*.css'], ['style-dev']);
	gulp.watch(['src/js/**'], ['reload-js']);
	gulp.watch(['src/fonts/**'], ['reload-fonts']);
	gulp.watch(['src/theme/**'], ['reload-theme']);
	gulp.watch(['src/plugins/**'], ['reload-plugins']);
	gulp.watch('build/wordpress/wp-config*.php', event => {
		if (event.type === 'added') {
			gulp.start('disable-cron');
		}
	});
});

/* -------------------------------------------------------------------------------------------------
Production Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task('build-prod', [
	'copy-theme-prod',
	'copy-fonts-prod',
	'style-prod',
	'header-scripts-prod',
	'footer-scripts-prod',
	'plugins-prod',
	'zip-theme',
]);

gulp.task('copy-theme-prod', () => {
	gulp.src(['src/theme/**', '!src/theme/img/**']).pipe(gulp.dest('dist/themes/' + themeName));
});

gulp.task('copy-fonts-prod', () => {
	gulp.src('src/fonts/**').pipe(gulp.dest('dist/themes/' + themeName + '/fonts'));
});

gulp.task('process-images', ['copy-theme-prod'], () => {
	return gulp
		.src('src/theme/img/**')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(
			imagemin([imagemin.svgo({ plugins: [{ removeViewBox: true }] })], {
				verbose: true,
			}),
		)
		.pipe(gulp.dest('dist/themes/' + themeName + '/img'));
});

gulp.task('style-prod', () => {
	return gulp
		.src('src/style/style.css')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(postcss(pluginsProd))
		.pipe(gulp.dest('dist/themes/' + themeName));
});

gulp.task('header-scripts-prod', () => {
	return gulp
		.src(headerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(concat('header-bundle.js'))
		.pipe(uglify())
		.pipe(gulp.dest('dist/themes/' + themeName + '/js'));
});

gulp.task('footer-scripts-prod', () => {
	return gulp
		.src(footerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(
			babel({
				presets: ['@babel/preset-env'],
			}),
		)
		.pipe(concat('footer-bundle.js'))
		.pipe(uglify())
		.pipe(gulp.dest('dist/themes/' + themeName + '/js'));
});

gulp.task('plugins-prod', () => {
	return gulp.src('src/plugins/**').pipe(gulp.dest('dist/plugins'));
});

gulp.task(
	'zip-theme',
	[
		'copy-theme-prod',
		'copy-fonts-prod',
		'process-images',
		'style-prod',
		'header-scripts-prod',
		'footer-scripts-prod',
		'plugins-prod',
	],
	() => {
		gulp
			.src('dist/themes/' + themeName + '/**')
			.pipe(zip(themeName + '.zip'))
			.pipe(gulp.dest('dist'))
			.on('end', () => {
				gutil.beep();
				gutil.log(pluginsGenerated);
				gutil.log(filesGenerated);
				gutil.log(thankYou);
			});
	},
);

/* -------------------------------------------------------------------------------------------------
Utility Tasks
-------------------------------------------------------------------------------------------------- */
const onError = err => {
	gutil.beep();
	gutil.log(wpFy + ' - ' + errorMsg + ' ' + err.toString());
	this.emit('end');
};

const date = new Date().toLocaleDateString('en-GB').replace(/\//g, '.');
const errorMsg = '\x1b[41mError\x1b[0m';
const warning = '\x1b[43mWarning\x1b[0m';
const devServerReady =
	'Your development server is ready, start the workflow with the command: $ \x1b[1mnpm run dev\x1b[0m';
const buildNotFound =
	errorMsg +
	' ⚠　- You need to install WordPress first. Run the command: $ \x1b[1mnpm run install:wordpress\x1b[0m';
const filesGenerated =
	'Your ZIP template file was generated in: \x1b[1m' +
	__dirname +
	'/dist/' +
	themeName +
	'.zip\x1b[0m - ✅';
const pluginsGenerated =
	'Plugins are generated in: \x1b[1m' + __dirname + '/dist/plugins/\x1b[0m - ✅';
const backupsGenerated =
	'Your backup was generated in: \x1b[1m' + __dirname + '/backups/' + date + '.zip\x1b[0m - ✅';
const wpFy = '\x1b[42m\x1b[1mWordPressify\x1b[0m';
const wpFyUrl = '\x1b[2m - http://www.wordpressify.co/\x1b[0m';
const thankYou = 'Thank you for using ' + wpFy + wpFyUrl;

gulp.task('backup', () => {
	if (!fs.existsSync('./build')) {
		gutil.log(buildNotFound);
		process.exit(1);
	} else {
		gulp
			.src('build/wordpress/**')
			.pipe(zip(date + '.zip'))
			.pipe(gulp.dest('backups'))
			.on('end', () => {
				gutil.beep();
				gutil.log(backupsGenerated);
				gutil.log(thankYou);
			});
	}
});

/* -------------------------------------------------------------------------------------------------
End of all Tasks
-------------------------------------------------------------------------------------------------- */
<commit_msg>Update<commit_after>/* -------------------------------------------------------------------------------------------------

Build Configuration
Contributors: Luan Gjokaj, Adam McKenna, Mehdi Rezaei, Sören Wrede, Saneef Ansari

-------------------------------------------------------------------------------------------------- */
const babel = require('gulp-babel');
const browserSync = require('browser-sync');
const concat = require('gulp-concat');
const connect = require('gulp-connect-php');
const del = require('del');
const fs = require('fs');
const gulp = require('gulp');
const gutil = require('gulp-util');
const imagemin = require('gulp-imagemin');
const inject = require('gulp-inject-string');
const partialimport = require('postcss-easy-import');
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const postCSSMixins = require('postcss-mixins');
const postcssPresetEnv = require('postcss-preset-env');
const remoteSrc = require('gulp-remote-src');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');
const unzip = require('gulp-unzip');
const zip = require('gulp-zip');

/* -------------------------------------------------------------------------------------------------
Theme Name
-------------------------------------------------------------------------------------------------- */
const themeName = 'wordpressify';

/* -------------------------------------------------------------------------------------------------
PostCSS Plugins
-------------------------------------------------------------------------------------------------- */
const pluginsDev = [
	partialimport,
	postCSSMixins,
	postcssPresetEnv({
		stage: 0,
		features: {
			'nesting-rules': true,
			'color-mod-function': true,
			'custom-media': true,
		},
	}),
];
const pluginsProd = [
	partialimport,
	postCSSMixins,
	postcssPresetEnv({
		stage: 0,
		features: {
			'nesting-rules': true,
			'color-mod-function': true,
			'custom-media': true,
		},
	}),
];

/* -------------------------------------------------------------------------------------------------
Header & Footer JavaScript Boundles
-------------------------------------------------------------------------------------------------- */
const headerJS = [
	'node_modules/jquery/dist/jquery.js',
	'node_modules/nprogress/nprogress.js',
	'node_modules/aos/dist/aos.js',
	'node_modules/isotope-layout/dist/isotope.pkgd.js',
];
const footerJS = ['src/js/**'];

/* -------------------------------------------------------------------------------------------------
Installation Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task('default');

gulp.task('cleanup', () => {
	del(['build/**']);
	del(['dist/**']);
});

gulp.task('download-wordpress', () => {
	remoteSrc(['latest.zip'], {
		base: 'https://wordpress.org/',
	}).pipe(gulp.dest('build/'));
});

gulp.task('setup', ['unzip-wordpress', 'copy-config']);

gulp.task('unzip-wordpress', () => {
	gulp
		.src('build/latest.zip')
		.pipe(unzip())
		.pipe(gulp.dest('build/'));
});

gulp.task('copy-config', () => {
	gulp
		.src('wp-config.php')
		.pipe(inject.after("define('DB_COLLATE', '');", "\ndefine('DISABLE_WP_CRON', true);"))
		.pipe(gulp.dest('build/wordpress'))
		.on('end', () => {
			gutil.beep();
			gutil.log(devServerReady);
			gutil.log(thankYou);
		});
});

gulp.task('disable-cron', () => {
	fs.readFile('./build/wordpress/wp-config.php', (err, data) => {
		if (err) {
			gutil.log(
				wpFy + ' - ' + warning + ' wp-config.php still missing... WP_CRON was not disabled!',
			);
		}
		if (data) {
			if (data.indexOf('DISABLE_WP_CRON') >= 0) {
				gutil.log('WP_CRON is already disabled!');
			} else {
				gulp
					.src('build/wordpress/wp-config.php')
					.pipe(inject.after("define('DB_COLLATE', '');", "\ndefine('DISABLE_WP_CRON', true);"))
					.pipe(gulp.dest('build/wordpress'));
			}
		}
	});
});

gulp.task('fresh-install', () => {
	del(['src/**']).then(() => {
		gulp.src('tools/fresh-theme/**').pipe(gulp.dest('src'));
	});
});

/* -------------------------------------------------------------------------------------------------
Development Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task(
	'build-dev',
	[
		'copy-theme-dev',
		'copy-fonts-dev',
		'style-dev',
		'header-scripts-dev',
		'footer-scripts-dev',
		'plugins-dev',
		'watch',
	],
	() => {
		connect.server(
			{
				base: 'build/wordpress',
				port: '3020',
			},
			() => {
				browserSync({
					logPrefix: wpFy,
					proxy: '127.0.0.1:3020',
					host: '127.0.0.1',
					port: '3010',
					open: 'external'
				});
			},
		);
	},
);

gulp.task('copy-theme-dev', () => {
	if (!fs.existsSync('./build')) {
		gutil.log(buildNotFound);
		process.exit(1);
	} else {
		gulp.src('src/theme/**').pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName));
	}
});

gulp.task('copy-fonts-dev', () => {
	gulp
		.src('src/fonts/**')
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/fonts'));
});

gulp.task('style-dev', () => {
	return gulp
		.src('src/style/style.css')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(postcss(pluginsDev))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName))
		.pipe(browserSync.stream({ match: '**/*.css' }));
});

gulp.task('header-scripts-dev', () => {
	return gulp
		.src(headerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(concat('header-bundle.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/js'));
});

gulp.task('footer-scripts-dev', () => {
	return gulp
		.src(footerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(sourcemaps.init())
		.pipe(
			babel({
				presets: ['@babel/preset-env'],
			}),
		)
		.pipe(concat('footer-bundle.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('build/wordpress/wp-content/themes/' + themeName + '/js'));
});

gulp.task('plugins-dev', () => {
	return gulp.src('src/plugins/**').pipe(gulp.dest('build/wordpress/wp-content/plugins'));
});

gulp.task('reload-js', ['footer-scripts-dev', 'header-scripts-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-fonts', ['copy-fonts-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-theme', ['copy-theme-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('reload-plugins', ['plugins-dev'], done => {
	browserSync.reload();
	done();
});

gulp.task('watch', () => {
	gulp.watch(['src/style/**/*.css'], ['style-dev']);
	gulp.watch(['src/js/**'], ['reload-js']);
	gulp.watch(['src/fonts/**'], ['reload-fonts']);
	gulp.watch(['src/theme/**'], ['reload-theme']);
	gulp.watch(['src/plugins/**'], ['reload-plugins']);
	gulp.watch('build/wordpress/wp-config*.php', event => {
		if (event.type === 'added') {
			gulp.start('disable-cron');
		}
	});
});

/* -------------------------------------------------------------------------------------------------
Production Tasks
-------------------------------------------------------------------------------------------------- */
gulp.task('build-prod', [
	'copy-theme-prod',
	'copy-fonts-prod',
	'style-prod',
	'header-scripts-prod',
	'footer-scripts-prod',
	'plugins-prod',
	'zip-theme',
]);

gulp.task('copy-theme-prod', () => {
	gulp.src(['src/theme/**', '!src/theme/img/**']).pipe(gulp.dest('dist/themes/' + themeName));
});

gulp.task('copy-fonts-prod', () => {
	gulp.src('src/fonts/**').pipe(gulp.dest('dist/themes/' + themeName + '/fonts'));
});

gulp.task('process-images', ['copy-theme-prod'], () => {
	return gulp
		.src('src/theme/img/**')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(
			imagemin([imagemin.svgo({ plugins: [{ removeViewBox: true }] })], {
				verbose: true,
			}),
		)
		.pipe(gulp.dest('dist/themes/' + themeName + '/img'));
});

gulp.task('style-prod', () => {
	return gulp
		.src('src/style/style.css')
		.pipe(plumber({ errorHandler: onError }))
		.pipe(postcss(pluginsProd))
		.pipe(gulp.dest('dist/themes/' + themeName));
});

gulp.task('header-scripts-prod', () => {
	return gulp
		.src(headerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(concat('header-bundle.js'))
		.pipe(uglify())
		.pipe(gulp.dest('dist/themes/' + themeName + '/js'));
});

gulp.task('footer-scripts-prod', () => {
	return gulp
		.src(footerJS)
		.pipe(plumber({ errorHandler: onError }))
		.pipe(
			babel({
				presets: ['@babel/preset-env'],
			}),
		)
		.pipe(concat('footer-bundle.js'))
		.pipe(uglify())
		.pipe(gulp.dest('dist/themes/' + themeName + '/js'));
});

gulp.task('plugins-prod', () => {
	return gulp.src('src/plugins/**').pipe(gulp.dest('dist/plugins'));
});

gulp.task(
	'zip-theme',
	[
		'copy-theme-prod',
		'copy-fonts-prod',
		'process-images',
		'style-prod',
		'header-scripts-prod',
		'footer-scripts-prod',
		'plugins-prod',
	],
	() => {
		gulp
			.src('dist/themes/' + themeName + '/**')
			.pipe(zip(themeName + '.zip'))
			.pipe(gulp.dest('dist'))
			.on('end', () => {
				gutil.beep();
				gutil.log(pluginsGenerated);
				gutil.log(filesGenerated);
				gutil.log(thankYou);
			});
	},
);

/* -------------------------------------------------------------------------------------------------
Utility Tasks
-------------------------------------------------------------------------------------------------- */
const onError = err => {
	gutil.beep();
	gutil.log(wpFy + ' - ' + errorMsg + ' ' + err.toString());
	this.emit('end');
};

const date = new Date().toLocaleDateString('en-GB').replace(/\//g, '.');
const errorMsg = '\x1b[41mError\x1b[0m';
const warning = '\x1b[43mWarning\x1b[0m';
const devServerReady =
	'Your development server is ready, start the workflow with the command: $ \x1b[1mnpm run dev\x1b[0m';
const buildNotFound =
	errorMsg +
	' ⚠　- You need to install WordPress first. Run the command: $ \x1b[1mnpm run install:wordpress\x1b[0m';
const filesGenerated =
	'Your ZIP template file was generated in: \x1b[1m' +
	__dirname +
	'/dist/' +
	themeName +
	'.zip\x1b[0m - ✅';
const pluginsGenerated =
	'Plugins are generated in: \x1b[1m' + __dirname + '/dist/plugins/\x1b[0m - ✅';
const backupsGenerated =
	'Your backup was generated in: \x1b[1m' + __dirname + '/backups/' + date + '.zip\x1b[0m - ✅';
const wpFy = '\x1b[42m\x1b[1mWordPressify\x1b[0m';
const wpFyUrl = '\x1b[2m - http://www.wordpressify.co/\x1b[0m';
const thankYou = 'Thank you for using ' + wpFy + wpFyUrl;

gulp.task('backup', () => {
	if (!fs.existsSync('./build')) {
		gutil.log(buildNotFound);
		process.exit(1);
	} else {
		gulp
			.src('build/wordpress/**')
			.pipe(zip(date + '.zip'))
			.pipe(gulp.dest('backups'))
			.on('end', () => {
				gutil.beep();
				gutil.log(backupsGenerated);
				gutil.log(thankYou);
			});
	}
});

/* -------------------------------------------------------------------------------------------------
End of all Tasks
-------------------------------------------------------------------------------------------------- */
<|endoftext|>


<commit_before>var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require("vinyl-source-stream");
var babel = require('gulp-babel');
var concatCss = require('gulp-concat-css');
var cssmin = require('gulp-cssmin');
var del = require('del');
var shell = require('gulp-shell');

var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
// webpack config to build and serve examples
var exampleConfig = require('./webpack.example.config');
// webpack config to build umd bundle
var umdConfig = require('./webpack.umd.config');

var watching = false;
var demo = false;

gulp.task('default', ['prod']);

gulp.task('clean', function() {
  return del([
    './dist/*',
    './lib/**'
  ]);
})

//------------
// PROD
// -----------
gulp.task('prod', ['umdBuild'], function() {
  // - Use gulp-babel to transpile each file for ppl who use webpack/browserify
  // - This will be the package.json entry point
  // - Most of the ppl will use this, and should use their own source maps when bundling,
  // as well as uglify in production.
  // - This is the way React itself distributes their package,
  // as well as other libraries like react-boostrap
  gulp.src(['./src/**/*.js', './src/*js'])
    .pipe(babel())
    .pipe(gulp.dest('./lib'));
  // build the css
  gulp.src('./css/react-bootstrap-table.css')
    .pipe(concatCss("./react-bootstrap-table.min.css"))
    .pipe(cssmin())
    .pipe(gulp.dest('./css'));
  gulp.src(['./css/react-bootstrap-table.css', './css/toastr.css'])
    .pipe(concatCss('./react-bootstrap-table-all.min.css'))
    .pipe(cssmin())
    .pipe(gulp.dest('./css'));
});

// build umd bundles for https://npmcdn.com/ and for browser <script> tag
gulp.task('umdBuild', ['clean'], shell.task([
  'webpack --config webpack.umd.config.js',
  'webpack --config webpack.umd.min.config.js'
]));

//------------
// EXAMPLES
// -----------
gulp.task('example-server', function() {

  new WebpackDevServer(webpack(exampleConfig), {
    publicPath: exampleConfig.serverConfig.publicPath,
    contentBase: exampleConfig.serverConfig.contentBase,
    hot: true,
    headers: {
      'Access-Control-Allow-Origin': '*'
    },
    historyApiFallback: true
  }).listen(exampleConfig.serverConfig.port, 'localhost', function(err, result) {
    if (err) {
      console.log(err);
    }

    console.log('Listening at localhost:3004');
  });

});

// TODO: consider droping browserify and just use webpack
//------------
// DEMO
// -----------
gulp.task("dev", function() {
  watching = true;
  buildDemoCode();
});

function buildDemoCode() {
  demo = true;
  browserifing("./demo/js/demo.js", "demo.bundle.js", "./demo/js");
}

function browserifing(main, bundleName, dest) {
  var b = browserify({
    entries: [main],
    transform: ["babelify"],
    cache: {},
    debug: true,
    packageCache: {},
    fullPaths: true,
  });

  if (demo)
    b = b.require(require.resolve('./src/index.js'), {
      expose: 'react-bootstrap-table'
    });

  if (watching) {
    b = watchify(b);
    b.on('update', function() {
      bundle(b, bundleName, dest);
    });
  }
  bundle(b, bundleName, dest);
}

function bundle(b, bundleName, dest) {
  b.bundle()
    .on('error', function(err) {
      console.log(err.message);
    })
    .on('end', function() {
      console.log("building success.");
    })
    .pipe(source(bundleName))
    .pipe(gulp.dest(dest));
}
<commit_msg>Output more easily readable messages in webpack<commit_after>var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require("vinyl-source-stream");
var babel = require('gulp-babel');
var concatCss = require('gulp-concat-css');
var cssmin = require('gulp-cssmin');
var del = require('del');
var shell = require('gulp-shell');

var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
// webpack config to build and serve examples
var exampleConfig = require('./webpack.example.config');
// webpack config to build umd bundle
var umdConfig = require('./webpack.umd.config');

var watching = false;
var demo = false;

gulp.task('default', ['prod']);

gulp.task('clean', function() {
  return del([
    './dist/*',
    './lib/**'
  ]);
})

//------------
// PROD
// -----------
gulp.task('prod', ['umdBuild'], function() {
  // - Use gulp-babel to transpile each file for ppl who use webpack/browserify
  // - This will be the package.json entry point
  // - Most of the ppl will use this, and should use their own source maps when bundling,
  // as well as uglify in production.
  // - This is the way React itself distributes their package,
  // as well as other libraries like react-boostrap
  gulp.src(['./src/**/*.js', './src/*js'])
    .pipe(babel())
    .pipe(gulp.dest('./lib'));
  // build the css
  gulp.src('./css/react-bootstrap-table.css')
    .pipe(concatCss("./react-bootstrap-table.min.css"))
    .pipe(cssmin())
    .pipe(gulp.dest('./css'));
  gulp.src(['./css/react-bootstrap-table.css', './css/toastr.css'])
    .pipe(concatCss('./react-bootstrap-table-all.min.css'))
    .pipe(cssmin())
    .pipe(gulp.dest('./css'));
});

// build umd bundles for https://npmcdn.com/ and for browser <script> tag
gulp.task('umdBuild', ['clean'], shell.task([
  'webpack --config webpack.umd.config.js',
  'webpack --config webpack.umd.min.config.js'
]));

//------------
// EXAMPLES
// -----------
gulp.task('example-server', function() {

  new WebpackDevServer(webpack(exampleConfig), {
    publicPath: exampleConfig.serverConfig.publicPath,
    contentBase: exampleConfig.serverConfig.contentBase,
    hot: true,
    headers: {
      'Access-Control-Allow-Origin': '*'
    },
    stats: {
      assets: true,
      colors: true,
      version: false,
      hash: false,
      timings: true,
      chunks: true,
      chunkModules: false
    },
    historyApiFallback: true
  }).listen(exampleConfig.serverConfig.port, 'localhost', function(err, result) {
    if (err) {
      console.log(err);
    }

    console.log('Listening at localhost:3004');
  });

});

// TODO: consider droping browserify and just use webpack
//------------
// DEMO
// -----------
gulp.task("dev", function() {
  watching = true;
  buildDemoCode();
});

function buildDemoCode() {
  demo = true;
  browserifing("./demo/js/demo.js", "demo.bundle.js", "./demo/js");
}

function browserifing(main, bundleName, dest) {
  var b = browserify({
    entries: [main],
    transform: ["babelify"],
    cache: {},
    debug: true,
    packageCache: {},
    fullPaths: true,
  });

  if (demo)
    b = b.require(require.resolve('./src/index.js'), {
      expose: 'react-bootstrap-table'
    });

  if (watching) {
    b = watchify(b);
    b.on('update', function() {
      bundle(b, bundleName, dest);
    });
  }
  bundle(b, bundleName, dest);
}

function bundle(b, bundleName, dest) {
  b.bundle()
    .on('error', function(err) {
      console.log(err.message);
    })
    .on('end', function() {
      console.log("building success.");
    })
    .pipe(source(bundleName))
    .pipe(gulp.dest(dest));
}
<|endoftext|>


<commit_before>'use strict';

var gulp = require('gulp');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var watchify = require('watchify');
var browserify = require('browserify');
var mocha = require('gulp-mocha');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var mochaPhantomjs = require('gulp-mocha-phantomjs');

var nodeFilesToWatch = ['app.js', 'api/**/*.js'];
var nodeTestFiles = ['api/**/test/*.js'];

/*
    Api tasks
*/
gulp.task('mocha', function () {
    return gulp.src(nodeTestFiles, {read: false})
        .pipe(mocha({reporter: 'nyan'}));
});

gulp.task('lint-api', function() {
    return gulp.src(['app.js', './api/**/*.js'])
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

/*
    Client tasks
*/
gulp.task('browserify', function() {
    var bundleStream = browserify({
        entries: ['./client/main.js'],
        debug: true
    }).bundle().pipe(source('bundle.js'));
    return bundleStream.pipe(gulp.dest('./public'));
});

gulp.task('testify', function() {
    var bundleStream = browserify({
        entries: ['./client/**/test/*.js'],
        debug: true
    }).bundle().pipe(source('test.bundle.js'));
    return bundleStream.pipe(gulp.dest('./public'));
});

gulp.task('views', function () {
    gulp.src('client/index.html')
        .pipe(gulp.dest('public/'));

    gulp.src('client/todo/*.html')
        .pipe(gulp.dest('public/todo/'));
});

gulp.task('sass', function () {
    gulp.src('client/sass/*.scss')
        .pipe(sass({ onError: function (err) {
            console.error(err);
        }}))
        .pipe(autoprefixer('last 2 versions', '> 1%', 'ie 8'))
        .pipe(gulp.dest('public/css/'));
});

gulp.task('lint-client', function() {
    return gulp.src('./client/**/*.js')
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

/*
    Watchers
*/
gulp.task('watch', function () {
    gulp.watch(['app.js', 'api/**/*.js'], ['lint-api']);
    gulp.watch('client/**/*.js', ['lint-client', 'browserify']);
    gulp.watch(['client/**/*.html'], ['views']);
    gulp.watch(['client/sass/*.scss'], ['sass']);
});

gulp.task('test', function () {
    gulp.watch(nodeFilesToWatch, ['mocha']);
});
<commit_msg>replaced vinyl packages with vinyl-transform<commit_after>'use strict';

var gulp = require('gulp');
// var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
// var source = require('vinyl-source-stream');
// var buffer = require('vinyl-buffer');
var transform = require('vinyl-transform');
var rename = require('gulp-rename');
// var watchify = require('watchify');
var browserify = require('browserify');
var mocha = require('gulp-mocha');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
// var minifyCSS = require('gulp-minify-css');
// var mochaPhantomjs = require('gulp-mocha-phantomjs');

var nodeFilesToWatch = ['app.js', 'api/**/*.js'];
var nodeTestFiles = ['api/**/test/*.js'];

/*
    Api tasks
*/
gulp.task('mocha', function () {
    return gulp.src(nodeTestFiles, {read: false})
        .pipe(mocha({reporter: 'nyan'}));
});

gulp.task('lint-api', function() {
    return gulp.src(['app.js', './api/**/*.js'])
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

/*
    Client tasks
*/
gulp.task('browserify', function() {
    var bundle = transform(function(filename) {
        var b = browserify({
            entries: filename,
            debug: true,
            insertGlobals: true
        });
        return b.bundle();
    });

    return gulp.src(['./client/main.js'])
        .pipe(bundle)
        .pipe(sourcemaps.init({loadMaps: true}))
        .pipe(uglify())
        .pipe(rename('bundle.js'))
        .pipe(sourcemaps.write('./'))
        .pipe(gulp.dest('./public'))
        .pipe(gulp.dest('./client/test'));
    // var bundleStream = browserify({
    //     entries: ['./client/main.js'],
    //     debug: true
    // }).bundle().pipe(source('bundle.js'));
    // return bundleStream.pipe(gulp.dest('./public'));
});

gulp.task('browserify-tests', function() {
    // var bundleStream = browserify({
    //     entries: ['./client/todo/test/todo.ctrl.test.js'],
    //     debug: true
    // }).bundle().pipe(source('test.bundle.js'));
    // return bundleStream.pipe(gulp.dest('./client/test/'));
    var browserified = transform(function(filename) {
        var b = browserify(filename);
        return b.bundle();
    });

    // hello gulp.src() my old friend
    return gulp.src(['./client/**/test/*.js'])
        .pipe(browserified)
        .pipe(rename('test.bundle.js'))
        .pipe(gulp.dest('./client/test'));
});

gulp.task('views', function () {
    gulp.src('client/index.html')
        .pipe(gulp.dest('public/'));

    gulp.src('client/todo/*.html')
        .pipe(gulp.dest('public/todo/'));
});

gulp.task('sass', function () {
    gulp.src('client/sass/*.scss')
        .pipe(sass({ onError: function (err) {
            console.error(err);
        }}))
        .pipe(autoprefixer('last 2 versions', '> 1%', 'ie 8'))
        .pipe(gulp.dest('public/css/'));
});

gulp.task('lint-client', function() {
    return gulp.src(['client/**/*.js', '!client/test/*.js'])
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

/*
    Watchers
*/
gulp.task('watch', function () {
    gulp.watch(['app.js', 'api/**/*.js'], ['lint-api']);
    gulp.watch(['client/**/*.js', '!client/test/*.js'], ['lint-client', 'browserify']);
    gulp.watch(['client/**/*.html'], ['views']);
    gulp.watch(['client/sass/*.scss'], ['sass']);
});

gulp.task('test', function () {
    gulp.watch(nodeFilesToWatch, ['mocha']);
});
<|endoftext|>


<commit_before>var gulp = require('gulp'),
  runSequence = require('run-sequence'),
  rimraf = require('rimraf').sync,
  requireDir = require('require-dir'),
  browser = require('browser-sync'),
  config = require('./gulp/config'),
  port = process.env.SERVER_PORT || 3001;

requireDir('./gulp');

/**
 * Gulp task default.
 * Calls build:all.
 */
gulp.task('default', ['serve', 'watch']);

/**
 * Gulp task build:all.
 * Calls build:foundation and build:standalone.
 */
gulp.task('build:all', ['build:foundation', 'build:standalone']);

/**
 * Gulp task build:foundation.
 * Calls js:foundation and css:foundation.
 */
gulp.task('build:foundation', ['js:foundation', 'css:foundation']);

/**
 * Gulp task build:standalone.
 * Calls js:standalone and css:standalone.
 */
gulp.task('build:standalone', ['js:standalone', 'css:standalone']);

/**
 * Gulp task dist.
 * Copies the built files into the dist folder.
 */
gulp.task('dist', ['js:min', 'css:min'], function() {
  // uninified files
  gulp.src([config.buildPath + 'assets/*'])
    .pipe(gulp.dest(config.destPath));
});

/**
 * Gulp task copy:assets.
 * Copies assets into visual test folder.
 */
gulp.task('copy:assets', ['build:all'], function() {
  gulp.src([config.buildPath + 'assets/*', './node_modules/{jquery,foundation-sites}/**/*'])
    .pipe(gulp.dest(config.testPath + 'assets/'));
});

/**
 * Gulp task watch.
 * Watch files for changes and reloads the browser.
 */
gulp.task('watch', function() {
  gulp.watch('js/**/*', [[['js:foundation'], 'js:standalone'], browser.reload]);
  gulp.watch('scss/**/*', [[['css:foundation'], 'css:standalone'], browser.reload]);
  gulp.watch(config.testPath + '*.html', [browser.reload]);
});

/**
 * Gulp task serve.
 * Starts a BrowerSync instance.
 */
gulp.task('serve', ['build:all', 'copy:assets'], function() {
  browser.init({server: config.testPath, port: port});
});

/**
 * Gulp task clean.
 * Deletes the build folder.
 */
gulp.task('clean', function () {
  rimraf(config.buildPath);
});

/**
 * Gulp task publish.
 * Publishes the visual tests to gh-pages.
 */
gulp.task('publish', function(cb) {
  exec('git subtree push --prefix ' + config.testPath + ' origin gh-pages', function(error, stdout, stderr) {
    console.log(stdout);
    cb();
  });
});<commit_msg>Added exec to gulp file.<commit_after>var gulp = require('gulp'),
  runSequence = require('run-sequence'),
  rimraf = require('rimraf').sync,
  requireDir = require('require-dir'),
  browser = require('browser-sync'),
  config = require('./gulp/config'),
  exec = require('child_process').exec,
  port = process.env.SERVER_PORT || 3000;

requireDir('./gulp');

/**
 * Gulp task default.
 * Calls build:all.
 */
gulp.task('default', ['serve', 'watch']);

/**
 * Gulp task build:all.
 * Calls build:foundation and build:standalone.
 */
gulp.task('build:all', ['build:foundation', 'build:standalone']);

/**
 * Gulp task build:foundation.
 * Calls js:foundation and css:foundation.
 */
gulp.task('build:foundation', ['js:foundation', 'css:foundation']);

/**
 * Gulp task build:standalone.
 * Calls js:standalone and css:standalone.
 */
gulp.task('build:standalone', ['js:standalone', 'css:standalone']);

/**
 * Gulp task dist.
 * Copies the built files into the dist folder.
 */
gulp.task('dist', ['js:min', 'css:min'], function() {
  // uninified files
  gulp.src([config.buildPath + 'assets/*'])
    .pipe(gulp.dest(config.destPath));
});

/**
 * Gulp task copy:assets.
 * Copies assets into visual test folder.
 */
gulp.task('copy:assets', ['build:all'], function() {
  gulp.src([config.buildPath + 'assets/*', './node_modules/{jquery,foundation-sites}/**/*'])
    .pipe(gulp.dest(config.testPath + 'assets/'));
});

/**
 * Gulp task watch.
 * Watch files for changes and reloads the browser.
 */
gulp.task('watch', function() {
  gulp.watch('js/**/*', [[['js:foundation'], 'js:standalone'], browser.reload]);
  gulp.watch('scss/**/*', [[['css:foundation'], 'css:standalone'], browser.reload]);
  gulp.watch(config.testPath + '*.html', [browser.reload]);
});

/**
 * Gulp task serve.
 * Starts a BrowerSync instance.
 */
gulp.task('serve', ['build:all', 'copy:assets'], function() {
  browser.init({server: config.testPath, port: port});
});

/**
 * Gulp task clean.
 * Deletes the build folder.
 */
gulp.task('clean', function () {
  rimraf(config.buildPath);
});

/**
 * Gulp task publish.
 * Publishes the visual tests to gh-pages.
 */
gulp.task('publish', function(cb) {
  exec('git subtree push --prefix ' + config.testPath + ' origin gh-pages', function(error, stdout, stderr) {
    console.log(stdout);
    cb();
  });
});<|endoftext|>


<commit_before>var gulp = require('gulp'),
    plugins = require("gulp-load-plugins")(),
    stylish = require('jshint-stylish');

var paths = {
  dest_dir: 'cla_frontend/assets/',
  styles: 'cla_frontend/assets-src/stylesheets/*.scss',
  scripts: ['cla_frontend/assets-src/javascripts/cla.main.js'],
  images: 'cla_frontend/assets-src/images/**/*'
};

// compile scss
gulp.task('sass', function() {
  return gulp.src(paths.styles)
              .pipe(plugins.sass({errLogToConsole: true}))
              .pipe(gulp.dest(paths.dest_dir + 'stylesheets'));
});

// concat js
gulp.task('js', function() {
  return gulp.src(paths.scripts)
              .pipe(plugins.concat('cla.main.js'))
              .pipe(gulp.dest(paths.dest_dir + 'javascripts'));
});

// jshint js code
gulp.task('lint', function() {
  return gulp.src(paths.scripts)
              .pipe(plugins.jshint())
              .pipe(plugins.jshint.reporter(stylish));
});

// optimise images
gulp.task('images', function() {
  return gulp.src(paths.images)
              .pipe(plugins.imagemin({optimizationLevel: 5}))
              .pipe(gulp.dest(paths.dest_dir + 'images'));
});

// setup watches
gulp.task('watch', function() {
  gulp.watch(paths.styles, ['sass']);
  gulp.watch(paths.scripts, ['js', 'lint']);
});

// setup default tasks
gulp.task('default', ['build']);
gulp.task('build', ['sass', 'js', 'lint', 'images']);<commit_msg>Add watch to image folder<commit_after>var gulp = require('gulp'),
    plugins = require("gulp-load-plugins")(),
    stylish = require('jshint-stylish');

var paths = {
  dest_dir: 'cla_frontend/assets/',
  styles: 'cla_frontend/assets-src/stylesheets/**/*.scss',
  scripts: ['cla_frontend/assets-src/javascripts/cla.main.js'],
  images: 'cla_frontend/assets-src/images/**/*'
};

// compile scss
gulp.task('sass', function() {
  return gulp.src(paths.styles)
              .pipe(plugins.sass({errLogToConsole: true}))
              .pipe(gulp.dest(paths.dest_dir + 'stylesheets'));
});

// concat js
gulp.task('js', function() {
  return gulp.src(paths.scripts)
              .pipe(plugins.concat('cla.main.js'))
              .pipe(gulp.dest(paths.dest_dir + 'javascripts'));
});

// jshint js code
gulp.task('lint', function() {
  return gulp.src(paths.scripts)
              .pipe(plugins.jshint())
              .pipe(plugins.jshint.reporter(stylish));
});

// optimise images
gulp.task('images', function() {
  return gulp.src(paths.images)
              .pipe(plugins.imagemin({optimizationLevel: 5}))
              .pipe(gulp.dest(paths.dest_dir + 'images'));
});

// setup watches
gulp.task('watch', function() {
  gulp.watch(paths.styles, ['sass']);
  gulp.watch(paths.scripts, ['js', 'lint']);
  gulp.watch(paths.images, ['images']);
});

// setup default tasks
gulp.task('default', ['build']);
gulp.task('build', ['sass', 'js', 'lint', 'images']);<|endoftext|>


<commit_before>var gulp = require('gulp');
var bem = require('gulp-bem');
var concat = require('gulp-concat');
var del = require('del');
var jade = require('gulp-jade');
var pack = require('gulp-bem-pack');
var autoprefixer = require('gulp-autoprefixer');
var buildBranch = require('buildbranch');
var watch = require('gulp-watch');
var debug = require('gulp-debug');

var levels = [
    'libs/bootstrap/levels/*',
    'blocks',
    'pages'
];

var tree;

gulp.task('tree', function () {
    tree = bem.objects(levels).pipe(bem.deps()).pipe(bem.tree());
});

gulp.task('css', ['tree'], function () {
    function buildCSS(page) {
        return tree.deps('pages/' + page.id)
            .pipe(bem.src('{bem}.css'))
            .pipe(concat('index.css'))
            .pipe(autoprefixer({
                browsers: ['last 2 versions'],
                cascade: false
            }))
            .pipe(gulp.dest('dist' +
                (page.id === 'en' ? '' : '/' + page.id)
            ));
    }

    return bem.objects('pages').map(buildCSS);
});

gulp.task('html', ['tree'], function () {
    function buildHtml(page) {
        return tree.deps('pages/' + page.id)
            .pipe(bem.src('{bem}.jade'))
            .pipe(concat({
                path: page.path + '/index.jade',
                base: page.path
            }))
            .pipe(jade({ pretty: true }))
            .pipe(gulp.dest('dist' +
                (page.id === 'en' ? '' : '/' + page.id)
            ));
    }

    return bem.objects('pages').map(buildHtml);
});

gulp.task('clean', function (cb) {
    del(['dist'], cb);
});

gulp.task('build', ['html', 'css']);

gulp.task('production', ['build']);

gulp.task('gh', ['production'], function(done) {
    buildBranch({ folder: 'dist', ignore: ['libs'] }, done);
});

gulp.task('express', function() {
    var express = require('express');
    var app = express();
    app.use(express.static('dist'));
    app.listen(4000);
    console.log('Server is running on http://localhost:4000/');
});

gulp.task('watch', ['express', 'build'], function() {
    watch('{blocks,pages}/**/*.deps.js',  function () { gulp.start('build'); });
    watch('{blocks,pages}/**/*.css',  function () { gulp.start('css'); });
    watch('{blocks,pages}/**/*.jade', function () { gulp.start('html'); });
    watch('*.md', function () { gulp.start('html'); });
    watch('*.js', function () { gulp.start('build'); });
});

gulp.task('default', ['watch']);
<commit_msg>feat(assets): add task for assets copying<commit_after>var gulp = require('gulp');
var bem = require('gulp-bem');
var concat = require('gulp-concat');
var del = require('del');
var jade = require('gulp-jade');
var pack = require('gulp-bem-pack');
var autoprefixer = require('gulp-autoprefixer');
var buildBranch = require('buildbranch');
var watch = require('gulp-watch');
var debug = require('gulp-debug');

var levels = [
    'libs/bootstrap/levels/*',
    'blocks',
    'pages'
];

var tree;

gulp.task('tree', function () {
    tree = bem.objects(levels).pipe(bem.deps()).pipe(bem.tree());
});

gulp.task('css', ['tree'], function () {
    function buildCSS(page) {
        return tree.deps('pages/' + page.id)
            .pipe(bem.src('{bem}.css'))
            .pipe(concat('index.css'))
            .pipe(autoprefixer({
                browsers: ['last 2 versions'],
                cascade: false
            }))
            .pipe(gulp.dest('dist' +
                (page.id === 'en' ? '' : '/' + page.id)
            ));
    }

    return bem.objects('pages').map(buildCSS);
});

gulp.task('html', ['tree'], function () {
    function buildHtml(page) {
        return tree.deps('pages/' + page.id)
            .pipe(bem.src('{bem}.jade'))
            .pipe(concat({
                path: page.path + '/index.jade',
                base: page.path
            }))
            .pipe(jade({ pretty: true }))
            .pipe(gulp.dest('dist' +
                (page.id === 'en' ? '' : '/' + page.id)
            ));
    }

    return bem.objects('pages').map(buildHtml);
});

gulp.task('assets', function () {
    return gulp.src('assets/**').pipe(gulp.dest('dist'));
});

gulp.task('clean', function (cb) {
    del(['dist'], cb);
});

gulp.task('build', ['html', 'css', 'assets']);

gulp.task('production', ['build']);

gulp.task('gh', ['production'], function(done) {
    buildBranch({ folder: 'dist', ignore: ['libs'] }, done);
});

gulp.task('express', function() {
    var express = require('express');
    var app = express();
    app.use(express.static('dist'));
    app.listen(4000);
    console.log('Server is running on http://localhost:4000/');
});

gulp.task('watch', ['express', 'build'], function() {
    watch('{blocks,pages}/**/*.deps.js',  function () { gulp.start('build'); });
    watch('{blocks,pages}/**/*.css',  function () { gulp.start('css'); });
    watch('{blocks,pages}/**/*.jade', function () { gulp.start('html'); });
    watch('*.md', function () { gulp.start('html'); });
    watch('*.js', function () { gulp.start('build'); });
});

gulp.task('default', ['watch']);
<|endoftext|>


<commit_before>var gulp = require('gulp');
var rename = require('gulp-rename');
var imagemin = require('gulp-imagemin');
var imageResize = require('gulp-image-resize');
var cleanCSS = require('gulp-clean-css');
var htmlmin = require('gulp-htmlmin');
var uglify = require('gulp-uglify');
var pump = require('pump');

gulp.task('default', function() {
  console.log('GULP GULP GULP');
});

gulp.task('imagemin', function() {
  console.log("Begin imagemin task...");
  gulp.src('src/img/*')
      .pipe(imagemin())
      .pipe(gulp.dest('dist/img/'));
  gulp.src('src/views/images/*')
      .pipe(imagemin())
      .pipe(gulp.dest('dist/views/images/'));
});

gulp.task('imageResize', function() {
  var srcImgPath = 'src/views/images/';
  var destImgPath = 'dist/views/images/';

  // 300 pixels wide
  gulp.src(srcImgPath + 'pizzeria.jpg')
      .pipe(rename('pizzeria-300.jpg'))
      .pipe(imageResize({
        width: 300,
        imageMagick: true,
        quality: 0.8
      }))
      .pipe(gulp.dest(destImgPath));

    // 720 pixels wide
    gulp.src(srcImgPath + 'pizzeria.jpg')
        .pipe(rename('pizzeria-720.jpg'))
        .pipe(imageResize({
          width: 720,
          imageMagick: true,
          quality: 0.8
        }))
        .pipe(gulp.dest(destImgPath));

    // 1440 pixels wide
    gulp.src(srcImgPath + 'pizzeria.jpg')
        .pipe(rename('pizzeria-1440.jpg'))
        .pipe(imageResize({
          width: 1440,
          imageMagick: true,
          quality: 0.8
        }))
        .pipe(gulp.dest(destImgPath));

});

gulp.task('minify-css', function() {
  gulp.src('src/css/*.css')
      .pipe(cleanCSS())
      .pipe(gulp.dest('dist/css/'));
  gulp.src('src/views/css/*.css')
      .pipe(cleanCSS())
      .pipe(gulp.dest('dist/views/css/'))
});

gulp.task('minify-html', function() {
  gulp.src('src/*.html')
      .pipe(htmlmin({
        collapseWhitespace: true,
        minifyCSS: true,
        minifyJS: true
      }))
      .pipe(gulp.dest('dist'));
  gulp.src('src/views/*.html')
      .pipe(htmlmin({
        collapseWhitespace: true,
        minifyCSS: true,
        minifyJS: true
      }))
      .pipe(gulp.dest('dist/views/'));
});

gulp.task('minify-js', function(err) {
  pump([gulp.src('src/js/*.js'),
        uglify(),
        gulp.dest('dist/js/')],
      err);

  pump([gulp.src('src/views/js/*.js'),
        uglify(),
        gulp.dest('dist/views/js/')],
      err);
});

// Watchers
var watchHTML = gulp.watch(['src/*.html', 'src/views/*.html'], ['minify-html']);
var watchCSS = gulp.watch(['src/css/*.css', 'src/views/css/*.css'], ['minify-css']);
var watchJS = gulp.watch(['src/js/*.js', 'src/views/js/*.js'], ['minify-js']);
[watchHTML, watchCSS, watchJS].forEach(function(watcher) {
  watcher.on('change', function(event) {
    console.log('GULP WATCHER');
    console.log('FILE: ' + event.path);
    console.log('TYPE: ' + event.type);
  });
});
<commit_msg>Resize pizzeria image to 100px in gulp task<commit_after>var gulp = require('gulp');
var rename = require('gulp-rename');
var imagemin = require('gulp-imagemin');
var imageResize = require('gulp-image-resize');
var cleanCSS = require('gulp-clean-css');
var htmlmin = require('gulp-htmlmin');
var uglify = require('gulp-uglify');
var pump = require('pump');

gulp.task('default', function() {
  console.log('GULP GULP GULP');
});

gulp.task('imagemin', function() {
  console.log("Begin imagemin task...");
  gulp.src('src/img/*')
      .pipe(imagemin())
      .pipe(gulp.dest('dist/img/'));
  gulp.src('src/views/images/*')
      .pipe(imagemin())
      .pipe(gulp.dest('dist/views/images/'));
});

gulp.task('imageResize', function() {
  var srcImgPath = 'src/views/images/';
  var destImgPath = 'dist/views/images/';

  // 100 pixels wide
  gulp.src(srcImgPath + 'pizzeria.jpg')
      .pipe(rename('pizzeria-100.jpg'))
      .pipe(imageResize({
        width: 100,
        imageMagick: true,
        quality: 0.8
      }))
      .pipe(gulp.dest(destImgPath));

  // 300 pixels wide
  gulp.src(srcImgPath + 'pizzeria.jpg')
      .pipe(rename('pizzeria-300.jpg'))
      .pipe(imageResize({
        width: 300,
        imageMagick: true,
        quality: 0.8
      }))
      .pipe(gulp.dest(destImgPath));

    // 720 pixels wide
    gulp.src(srcImgPath + 'pizzeria.jpg')
        .pipe(rename('pizzeria-720.jpg'))
        .pipe(imageResize({
          width: 720,
          imageMagick: true,
          quality: 0.8
        }))
        .pipe(gulp.dest(destImgPath));

    // 1440 pixels wide
    gulp.src(srcImgPath + 'pizzeria.jpg')
        .pipe(rename('pizzeria-1440.jpg'))
        .pipe(imageResize({
          width: 1440,
          imageMagick: true,
          quality: 0.8
        }))
        .pipe(gulp.dest(destImgPath));

});

gulp.task('minify-css', function() {
  gulp.src('src/css/*.css')
      .pipe(cleanCSS())
      .pipe(gulp.dest('dist/css/'));
  gulp.src('src/views/css/*.css')
      .pipe(cleanCSS())
      .pipe(gulp.dest('dist/views/css/'))
});

gulp.task('minify-html', function() {
  gulp.src('src/*.html')
      .pipe(htmlmin({
        collapseWhitespace: true,
        minifyCSS: true,
        minifyJS: true
      }))
      .pipe(gulp.dest('dist'));
  gulp.src('src/views/*.html')
      .pipe(htmlmin({
        collapseWhitespace: true,
        minifyCSS: true,
        minifyJS: true
      }))
      .pipe(gulp.dest('dist/views/'));
});

gulp.task('minify-js', function(err) {
  pump([gulp.src('src/js/*.js'),
        uglify(),
        gulp.dest('dist/js/')],
      err);

  pump([gulp.src('src/views/js/*.js'),
        uglify(),
        gulp.dest('dist/views/js/')],
      err);
});

// Watchers
var watchHTML = gulp.watch(['src/*.html', 'src/views/*.html'], ['minify-html']);
var watchCSS = gulp.watch(['src/css/*.css', 'src/views/css/*.css'], ['minify-css']);
var watchJS = gulp.watch(['src/js/*.js', 'src/views/js/*.js'], ['minify-js']);
[watchHTML, watchCSS, watchJS].forEach(function(watcher) {
  watcher.on('change', function(event) {
    console.log('GULP WATCHER');
    console.log('FILE: ' + event.path);
    console.log('TYPE: ' + event.type);
  });
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var sass = require('gulp-sass');
var pleeease = require('gulp-pleeease');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var browserSync = require('browser-sync');
var reload      = browserSync.reload;
var ejs = require("gulp-ejs");
var plumber = require("gulp-plumber");

// Sass

gulp.task('sass', function () {
    gulp.src('sass/**/*.scss')
        .pipe(sass().on('error', sass.logError)) // Keep running gulp even though occurred compile error
        .pipe(pleeease({
            autoprefixer: {
                browsers: ['last 2 versions']
            }
        }))
        .pipe(gulp.dest('build/css'))
        .pipe(reload({stream:true}));
});

// Js-concat-uglify

gulp.task('js', function() {
    gulp.src(['js/*.js'])
        .pipe(concat('scripts.js'))
        .pipe(uglify({preserveComments: 'some'})) // Keep some comments
        .pipe(gulp.dest('build/js'))
        .pipe(reload({stream:true}));
});

// Imagemin

gulp.task('imagemin', function() {
    gulp.src(['images/**/*.{png,jpg,gif,svg}'])
        .pipe(imagemin({
            optimizationLevel: 7,
            use: [pngquant({
                quality: '60-80',
                speed: 1
            })]
        }))
        .pipe(gulp.dest('build/images'));
});

// ejs

var fs = require('fs');
var json = JSON.parse(fs.readFileSync("site.json")); // parse json
gulp.task("ejs", function() {
    gulp.src(['templates/*.ejs','!' + 'templates/_*.ejs']) // Don't build html which starts from underline
        .pipe(plumber())
        .pipe(ejs(json, {"ext": ".html"}))
        .pipe(gulp.dest('build'))
});

// Static server

gulp.task('browser-sync', function() {
    browserSync({
        server: {
            baseDir: "build/", //　Target directory
            index  : "index.html" // index file
        }
    });
});

// Reload all browsers

gulp.task('bs-reload', function () {
    browserSync.reload();
});

// Task for `gulp` command

gulp.task('default',['browser-sync'], function() {
    gulp.watch('sass/**/*.scss',['sass']);
    gulp.watch('js/*.js',['js']);
    gulp.watch('images/**',['imagemin']);
    gulp.watch("build/*.html", ['bs-reload']);
    gulp.watch(['templates/*.ejs', 'site.json'], ['ejs']);
});
<commit_msg>delete gulpfile<commit_after><|endoftext|>


<commit_before>'use strict';

var argv = require('yargs').argv;
var gulp = require('gulp');
var exec = require('child_process').exec;
var sass = require('gulp-sass');
var merge = require('merge2');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var embedTemplates = require('gulp-angular-embed-templates');
var SystemBuilder = require('systemjs-builder');
var typescript = require('gulp-typescript');
var tsconfig = require('./tsconfig.json');
var tsProject = typescript.createProject(tsconfig.compilerOptions);

if (!argv.production) {
    var tslint = require('gulp-tslint');
    var sassLint = require('gulp-sass-lint');
}

var sass_path = './frontend/**/*.scss';
var ts_path = './frontend/**/*.ts';
var static_npm_file_paths = [
    'node_modules/bootstrap/dist/css/bootstrap.min.css',
    'node_modules/bootstrap/dist/css/bootstrap.min.css.map',
    'node_modules/rxjs/**/*',
    'node_modules/angular2-in-memory-web-api/**/*',
    'node_modules/@angular/**/*',
    'node_modules/systemjs/dist/system.src.js'
];
var angular_dependencies = [
    'node_modules/es6-shim/es6-shim.min.js',
    'node_modules/zone.js/dist/zone.js',
    'node_modules/reflect-metadata/Reflect.js'
];
var build_path = 'strassengezwitscher/static/build/';
var dist_path = 'strassengezwitscher/static/dist/';

gulp.task('copy:npmfiles', function() {
    return gulp.src(static_npm_file_paths.concat(angular_dependencies), {base: 'node_modules/'})
        .pipe(gulp.dest(build_path));
});

gulp.task('copy:systemjsconfig', function() {
    return gulp.src('systemjs.config.js')
        .pipe(gulp.dest(build_path));
});

gulp.task('copy:staticfiles', ['copy:npmfiles', 'copy:systemjsconfig']);

gulp.task('compile:sass', function() {
    return gulp.src(sass_path)
        .pipe(sourcemaps.init())
        .pipe(sass().on('error', sass.logError))
        .pipe(concat('bundle.dev.css'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(build_path));
});

gulp.task('compile:typescript', function() {
    var tsResult = gulp.src(ts_path)
        .pipe(sourcemaps.init())
        .pipe(typescript(tsProject));
    return merge([
        tsResult.dts.pipe(gulp.dest(build_path)),
        tsResult.js
            .pipe(embedTemplates())
            .pipe(sourcemaps.write())
            .pipe(gulp.dest(build_path))
    ]);
});

gulp.task('bundle:typescript', ['copy:staticfiles', 'compile:typescript'], function() {
    var builder = new SystemBuilder(build_path, {
        map: {
            '@angular/common.js': '@angular/common',
            '@angular/compiler.js': '@angular/compiler',
            '@angular/core.js': '@angular/core',
            '@angular/http.js': '@angular/http',
            '@angular/platform-browser.js': '@angular/platform-browser',
            '@angular/platform-browser-dynamic.js': '@angular/platform-browser-dynamic',
            '@angular/router.js': '@angular/router',
            '@angular/router-deprecated.js': '@angular/router-deprecated',
            '@angular/testing.js': '@angular/testing',
            '@angular/upgrade.js': '@angular/upgrade',
        },
        packages: {
          'rxjs': { defaultExtension: 'js' },
          'angular2-in-memory-web-api': { defaultExtension: 'js' },
          '@angular/common': { main: 'index.js', defaultExtension: 'js' },
          '@angular/compiler': { main: 'index.js', defaultExtension: 'js' },
          '@angular/core': { main: 'index.js', defaultExtension: 'js' },
          '@angular/http': { main: 'index.js', defaultExtension: 'js' },
          '@angular/platform-browser': { main: 'index.js', defaultExtension: 'js' },
          '@angular/platform-browser-dynamic': { main: 'index.js', defaultExtension: 'js' },
          '@angular/router': { main: 'index.js', defaultExtension: 'js' },
          '@angular/router-deprecated': { main: 'index.js', defaultExtension: 'js' },
          '@angular/testing': { main: 'index.js', defaultExtension: 'js' },
          '@angular/upgrade': { main: 'index.js', defaultExtension: 'js' },
      }
    });
    builder.loader.defaultJSExtensions = true;
    return builder.buildStatic('main', dist_path + '/bundle.js', {
        minify: true
    });
});

gulp.task('bundle:dependencies', function() {
    return gulp.src([
        'node_modules/es6-shim/es6-shim.min.js',
        'node_modules/zone.js/dist/zone.js',
        'node_modules/reflect-metadata/Reflect.js'
    ]).pipe(concat('dependencies.js'))
    .pipe(uglify())
    .pipe(gulp.dest(dist_path));
});

gulp.task('bundle:sass', ['compile:sass'], function() {
    return gulp.src([
        build_path + '/bootstrap/**/*.css',
        build_path + '/bundle.dev.css'
    ]).pipe(concat('bundle.css'))
        .pipe(cssnano())
        .pipe(gulp.dest(dist_path));
});

gulp.task('dist', ['bundle:dependencies', 'bundle:typescript', 'bundle:sass']);

gulp.task('watch:sass', ['compile:sass'], function() {
    return gulp.watch(sass_path, ['compile:sass']);
});

gulp.task('watch:typescript', ['compile:typescript'], function() {
    return gulp.watch(ts_path, ['compile:typescript']);
});

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

gulp.task('build', ['copy:staticfiles', 'compile:typescript', 'compile:sass']);

gulp.task('default', function() {
  // place code for your default task here
});

if (!argv.production) {
    gulp.task('lint:python', function() {
        exec('prospector strassengezwitscher --uses django --strictness high', function (err, stdout, stderr) {
            console.log(stdout);
            console.log(stderr);
        });
    });

    gulp.task('lint:typescript', function() {
        return gulp.src(ts_path)
        .pipe(tslint())
        .pipe(tslint.report("prose", {
            emitError: false,
            summarizeFailureOutput: true
        }));
    });

    gulp.task('lint:sass', function() {
        return gulp.src(sass_path)
        .pipe(sassLint())
        .pipe(sassLint.format());
    });

    gulp.task('lint', ['lint:python', 'lint:typescript', 'lint:sass']);
}
<commit_msg>Make gulp:lint use the same linting settings as used by landscape.io for commits and pull requests.<commit_after>'use strict';

var argv = require('yargs').argv;
var gulp = require('gulp');
var exec = require('child_process').exec;
var sass = require('gulp-sass');
var merge = require('merge2');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var embedTemplates = require('gulp-angular-embed-templates');
var SystemBuilder = require('systemjs-builder');
var typescript = require('gulp-typescript');
var tsconfig = require('./tsconfig.json');
var tsProject = typescript.createProject(tsconfig.compilerOptions);

if (!argv.production) {
    var tslint = require('gulp-tslint');
    var sassLint = require('gulp-sass-lint');
}

var sass_path = './frontend/**/*.scss';
var ts_path = './frontend/**/*.ts';
var static_npm_file_paths = [
    'node_modules/bootstrap/dist/css/bootstrap.min.css',
    'node_modules/bootstrap/dist/css/bootstrap.min.css.map',
    'node_modules/rxjs/**/*',
    'node_modules/angular2-in-memory-web-api/**/*',
    'node_modules/@angular/**/*',
    'node_modules/systemjs/dist/system.src.js'
];
var angular_dependencies = [
    'node_modules/es6-shim/es6-shim.min.js',
    'node_modules/zone.js/dist/zone.js',
    'node_modules/reflect-metadata/Reflect.js'
];
var build_path = 'strassengezwitscher/static/build/';
var dist_path = 'strassengezwitscher/static/dist/';

gulp.task('copy:npmfiles', function() {
    return gulp.src(static_npm_file_paths.concat(angular_dependencies), {base: 'node_modules/'})
        .pipe(gulp.dest(build_path));
});

gulp.task('copy:systemjsconfig', function() {
    return gulp.src('systemjs.config.js')
        .pipe(gulp.dest(build_path));
});

gulp.task('copy:staticfiles', ['copy:npmfiles', 'copy:systemjsconfig']);

gulp.task('compile:sass', function() {
    return gulp.src(sass_path)
        .pipe(sourcemaps.init())
        .pipe(sass().on('error', sass.logError))
        .pipe(concat('bundle.dev.css'))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(build_path));
});

gulp.task('compile:typescript', function() {
    var tsResult = gulp.src(ts_path)
        .pipe(sourcemaps.init())
        .pipe(typescript(tsProject));
    return merge([
        tsResult.dts.pipe(gulp.dest(build_path)),
        tsResult.js
            .pipe(embedTemplates())
            .pipe(sourcemaps.write())
            .pipe(gulp.dest(build_path))
    ]);
});

gulp.task('bundle:typescript', ['copy:staticfiles', 'compile:typescript'], function() {
    var builder = new SystemBuilder(build_path, {
        map: {
            '@angular/common.js': '@angular/common',
            '@angular/compiler.js': '@angular/compiler',
            '@angular/core.js': '@angular/core',
            '@angular/http.js': '@angular/http',
            '@angular/platform-browser.js': '@angular/platform-browser',
            '@angular/platform-browser-dynamic.js': '@angular/platform-browser-dynamic',
            '@angular/router.js': '@angular/router',
            '@angular/router-deprecated.js': '@angular/router-deprecated',
            '@angular/testing.js': '@angular/testing',
            '@angular/upgrade.js': '@angular/upgrade',
        },
        packages: {
          'rxjs': { defaultExtension: 'js' },
          'angular2-in-memory-web-api': { defaultExtension: 'js' },
          '@angular/common': { main: 'index.js', defaultExtension: 'js' },
          '@angular/compiler': { main: 'index.js', defaultExtension: 'js' },
          '@angular/core': { main: 'index.js', defaultExtension: 'js' },
          '@angular/http': { main: 'index.js', defaultExtension: 'js' },
          '@angular/platform-browser': { main: 'index.js', defaultExtension: 'js' },
          '@angular/platform-browser-dynamic': { main: 'index.js', defaultExtension: 'js' },
          '@angular/router': { main: 'index.js', defaultExtension: 'js' },
          '@angular/router-deprecated': { main: 'index.js', defaultExtension: 'js' },
          '@angular/testing': { main: 'index.js', defaultExtension: 'js' },
          '@angular/upgrade': { main: 'index.js', defaultExtension: 'js' },
      }
    });
    builder.loader.defaultJSExtensions = true;
    return builder.buildStatic('main', dist_path + '/bundle.js', {
        minify: true
    });
});

gulp.task('bundle:dependencies', function() {
    return gulp.src([
        'node_modules/es6-shim/es6-shim.min.js',
        'node_modules/zone.js/dist/zone.js',
        'node_modules/reflect-metadata/Reflect.js'
    ]).pipe(concat('dependencies.js'))
    .pipe(uglify())
    .pipe(gulp.dest(dist_path));
});

gulp.task('bundle:sass', ['compile:sass'], function() {
    return gulp.src([
        build_path + '/bootstrap/**/*.css',
        build_path + '/bundle.dev.css'
    ]).pipe(concat('bundle.css'))
        .pipe(cssnano())
        .pipe(gulp.dest(dist_path));
});

gulp.task('dist', ['bundle:dependencies', 'bundle:typescript', 'bundle:sass']);

gulp.task('watch:sass', ['compile:sass'], function() {
    return gulp.watch(sass_path, ['compile:sass']);
});

gulp.task('watch:typescript', ['compile:typescript'], function() {
    return gulp.watch(ts_path, ['compile:typescript']);
});

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

gulp.task('build', ['copy:staticfiles', 'compile:typescript', 'compile:sass']);

gulp.task('default', function() {
  // place code for your default task here
});

if (!argv.production) {
    gulp.task('lint:python', function() {
        exec('prospector strassengezwitscher --profile ../.landscape.yml', function (err, stdout, stderr) {
            console.log(stdout);
            console.log(stderr);
        });
    });

    gulp.task('lint:typescript', function() {
        return gulp.src(ts_path)
        .pipe(tslint())
        .pipe(tslint.report("prose", {
            emitError: false,
            summarizeFailureOutput: true
        }));
    });

    gulp.task('lint:sass', function() {
        return gulp.src(sass_path)
        .pipe(sassLint())
        .pipe(sassLint.format());
    });

    gulp.task('lint', ['lint:python', 'lint:typescript', 'lint:sass']);
}
<|endoftext|>