<commit_before>process.env.DISABLE_NOTIFIER = true;
var elixir = require('laravel-elixir');

var scripts_include = [
    /*
     |--------------------------------------------------------------------------
     | Vendor Javascript
     |--------------------------------------------------------------------------
     */
    './bower_components/jquery/dist/jquery.js',
    './bower_components/bootstrap/dist/js/bootstrap.js',
    './bower_components/toastr/toastr.js',
    './bower_components/bootstrap-select/dist/js/bootstrap-select.js',
    './bower_components/emojify.js/dist/js/emojify.js',

    /*
     |--------------------------------------------------------------------------
     | App Javascript
     |--------------------------------------------------------------------------
     */
    './resources/assets/js/app.js',
    './resources/assets/js/modal.js',
    './resources/assets/js/notify.js',
    './resources/assets/js/pjax.js',
    './resources/assets/js/core.js',

    /*
     |--------------------------------------------------------------------------
     | Module Javascript
     |--------------------------------------------------------------------------
     */
    //'./modules/Forum/Resources/assets/js/*.js',
    //'./modules/Site/Resources/assets/js/*.js',
    //'./modules/User/Resources/assets/js/*.js',
    './modules/Message/Resources/assets/js/*.js'
];

var scripts_admin_include = [
    /*
     |--------------------------------------------------------------------------
     | Vendor Javascript
     |--------------------------------------------------------------------------
     */
    './bower_components/admin-lte/dist/js/app.js',
    './resources/assets/js/search.js',

    /*
     |--------------------------------------------------------------------------
     | Module Javascript
     |--------------------------------------------------------------------------
     */
    //'./modules/User/Resources/assets/js/admin/*.js',
];

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Less
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {

    // compile less
    mix.less(['app.less', 'admin.less'], 'public/static/css');
    // register custom watcher for less task
    mix.task('less', './modules/**/*.less');

    // concat scripts
    mix.scripts(scripts_include, 'public/static/js/app.js', './');
    mix.scripts(scripts_admin_include, 'public/static/js/admin.js', './');
    // register custom watcher for less task
    mix.task('scripts', './modules/**/*.js');

    // copy fonts
    mix.copy('./bower_components/bootstrap/dist/fonts', 'public/static/fonts');
    mix.copy('./bower_components/font-awesome/fonts', 'public/static/fonts');

    // copy images
    mix.copy('./bower_components/emojify.js/dist/images/basic', 'public/static/images/emojify');

    // copy admin statics
    //mix.copy('./bower_components/admin-lte/plugins', 'public/static/plugins');

    // versioning files
    //mix.version([
    //    'public/static/css/app.css',
    //    'public/static/css/admin.css',
    //    'public/static/js/app.js',
    //    'public/static/js/admin.js']);
});
<commit_msg>- fixed elixir watcher<commit_after>process.env.DISABLE_NOTIFIER = true;
var elixir = require('laravel-elixir');

var scripts_include = [
    /*
     |--------------------------------------------------------------------------
     | Vendor Javascript
     |--------------------------------------------------------------------------
     */
    './bower_components/jquery/dist/jquery.js',
    './bower_components/bootstrap/dist/js/bootstrap.js',
    './bower_components/toastr/toastr.js',
    './bower_components/bootstrap-select/dist/js/bootstrap-select.js',
    './bower_components/emojify.js/dist/js/emojify.js',

    /*
     |--------------------------------------------------------------------------
     | App Javascript
     |--------------------------------------------------------------------------
     */
    './resources/assets/js/app.js',
    './resources/assets/js/modal.js',
    './resources/assets/js/notify.js',
    './resources/assets/js/pjax.js',
    './resources/assets/js/core.js',

    /*
     |--------------------------------------------------------------------------
     | Module Javascript
     |--------------------------------------------------------------------------
     */
    //'./modules/Forum/Resources/assets/js/*.js',
    //'./modules/Site/Resources/assets/js/*.js',
    //'./modules/User/Resources/assets/js/*.js',
    './modules/Message/Resources/assets/js/*.js'
];

var scripts_admin_include = [
    /*
     |--------------------------------------------------------------------------
     | Vendor Javascript
     |--------------------------------------------------------------------------
     */
    './bower_components/admin-lte/dist/js/app.js',
    './resources/assets/js/search.js',

    /*
     |--------------------------------------------------------------------------
     | Module Javascript
     |--------------------------------------------------------------------------
     */
    //'./modules/User/Resources/assets/js/admin/*.js',
];

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Less
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(function(mix) {

    // compile less
    mix.less(['app.less', 'admin.less'], 'public/static/css');
    // register custom watcher for less task
    elixir.Task.find('less').watchers.push('./modules/**/*.less');

    // concat scripts
    mix.scripts(scripts_include, 'public/static/js/app.js', './');
    mix.scripts(scripts_admin_include, 'public/static/js/admin.js', './');
    // NOTE: watcher for every given script are added automatically

    // copy fonts
    mix.copy('./bower_components/bootstrap/dist/fonts', 'public/static/fonts');
    mix.copy('./bower_components/font-awesome/fonts', 'public/static/fonts');

    // copy images
    mix.copy('./bower_components/emojify.js/dist/images/basic', 'public/static/images/emojify');

    // copy admin statics
    //mix.copy('./bower_components/admin-lte/plugins', 'public/static/plugins');

    // versioning files
    //mix.version([
    //    'public/static/css/app.css',
    //    'public/static/css/admin.css',
    //    'public/static/js/app.js',
    //    'public/static/js/admin.js']);
});
<|endoftext|>


<commit_before>
'use strict';

var argv = require('yargs').argv;
var browserify = require('browserify');
var gulp = require('gulp');
var LessPluginCleanCSS = require('less-plugin-clean-css');
var cleancss = new LessPluginCleanCSS({ advanced: true });
var plugins = require('gulp-load-plugins')();
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var bundler = browserify({
    entries: ['./public/javascripts/app.js'],
    debug: !argv.production,
    cache: {},
    packageCache: {},
    fullPaths: true // for watchify
});

gulp.task('less', function() {
    return gulp.src('./public/stylesheets/style.less')
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.if(
            argv.production,
            plugins.less({ plugins: [cleancss] }),
            plugins.less()
        ))
        .pipe(plugins.sourcemaps.write('./'))
        .pipe(gulp.dest('./public/stylesheets'));
});

gulp.task('browserify', function() {
    return bundler
        .bundle()
        .pipe(source('bundle.js'))
        .pipe(buffer())
        .pipe(plugins.if(
            !argv.production,
            plugins.sourcemaps.init({ loadMaps: true })
        ))
        .pipe(plugins.if(
            !argv.production,
            plugins.sourcemaps.write('./')
        ))
        .pipe(plugins.if(
            argv.production,
            plugins.uglify()
        ))
        .pipe(gulp.dest('./public/javascripts/'));
});

gulp.task('watchify', function() {
    var watcher  = watchify(bundler);

    return watcher
        .on('error', plugins.util.log.bind(plugins.util, 'Browserify Error'))
        .on('update', function() {
            watcher.bundle()
                .pipe(source('bundle.js'))
                .pipe(buffer())
                .pipe(sourcemaps.init({ loadMaps: true }))
                .pipe(sourcemaps.write('./'))
                .pipe(gulp.dest('./public/javascripts/'));

            plugins.util.log("Updated JavaScript sources");
        })
        .bundle() // Create the initial bundle when starting the task
        .pipe(source('bundle.js'))
        .pipe(gulp.dest('./public/javascripts/'));
});

gulp.task('lesswatch', function () {
    gulp.watch('./public/stylesheets/**/*.less', ['less']);
});

gulp.task('build', ['less', 'browserify']);
gulp.task('watch', ['lesswatch', 'watchify']);
gulp.task('default', ['build']);
<commit_msg>Added an empty clean task<commit_after>
'use strict';

var argv = require('yargs').argv;
var browserify = require('browserify');
var gulp = require('gulp');
var LessPluginCleanCSS = require('less-plugin-clean-css');
var cleancss = new LessPluginCleanCSS({ advanced: true });
var plugins = require('gulp-load-plugins')();
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var bundler = browserify({
    entries: ['./public/javascripts/app.js'],
    debug: !argv.production,
    cache: {},
    packageCache: {},
    fullPaths: true // for watchify
});

gulp.task('less', function() {
    return gulp.src('./public/stylesheets/style.less')
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.if(
            argv.production,
            plugins.less({ plugins: [cleancss] }),
            plugins.less()
        ))
        .pipe(plugins.sourcemaps.write('./'))
        .pipe(gulp.dest('./public/stylesheets'));
});

gulp.task('browserify', function() {
    return bundler
        .bundle()
        .pipe(source('bundle.js'))
        .pipe(buffer())
        .pipe(plugins.if(
            !argv.production,
            plugins.sourcemaps.init({ loadMaps: true })
        ))
        .pipe(plugins.if(
            !argv.production,
            plugins.sourcemaps.write('./')
        ))
        .pipe(plugins.if(
            argv.production,
            plugins.uglify()
        ))
        .pipe(gulp.dest('./public/javascripts/'));
});

gulp.task('watchify', function() {
    var watcher  = watchify(bundler);

    return watcher
        .on('error', plugins.util.log.bind(plugins.util, 'Browserify Error'))
        .on('update', function() {
            watcher.bundle()
                .pipe(source('bundle.js'))
                .pipe(buffer())
                .pipe(sourcemaps.init({ loadMaps: true }))
                .pipe(sourcemaps.write('./'))
                .pipe(gulp.dest('./public/javascripts/'));

            plugins.util.log("Updated JavaScript sources");
        })
        .bundle() // Create the initial bundle when starting the task
        .pipe(source('bundle.js'))
        .pipe(gulp.dest('./public/javascripts/'));
});

gulp.task('lesswatch', function () {
    gulp.watch('./public/stylesheets/**/*.less', ['less']);
});

gulp.task('clean', function() {
    //
});

gulp.task('build', ['less', 'browserify']);
gulp.task('watch', ['lesswatch', 'watchify']);
gulp.task('default', ['build']);
<|endoftext|>


<commit_before>var _ = require('underscore'),
	gulp = require('gulp'),
	cover = require('gulp-coverage'),
	jshint = require('gulp-jshint'),
	mocha = require('gulp-mocha'),
	gutil = require('gulp-util'),
	watch = require('gulp-watch'),
	browserify = require('browserify'),
	literalify = require('literalify'),
	watchify = require('watchify'),
	reactify = require('reactify'),
	source = require('vinyl-source-stream'),
	chalk = require('chalk'),
	del = require('del');

/**
 * Build Tasks
 */

// build scripts with browserify and react / jsx transforms
gulp.task('build-scripts', function() {
	return browserify({
			standalone: 'App'
		})
		.add('./admin/src/app.js')
		.transform(reactify)
		.transform(literalify.configure({
			tinymce: "window.tinymce"
		}))
		.bundle()
		.on('error', function(e) {
			gutil.log('Browserify Error', e);
		})
		.pipe(source('app.js'))
		.pipe(gulp.dest('./public/build/js'));
});

// watch scripts & build with debug features
gulp.task('watch-scripts', function() {

	var b = browserify(_.defaults({
			standalone: 'App'
		}, watchify.args))
		.add('./admin/src/app.js')
		.transform(reactify)
		.transform(literalify.configure({
			tinymce: "window.tinymce"
		}));

	var w = watchify(b)
		.on('update', function (scriptIds) {
			scriptIds = scriptIds
				.filter(function(i) { return i.substr(0,2) !== './' })
				.map(function(i) { return chalk.blue(i.replace(__dirname, '')) });
			if (scriptIds.length > 1) {
				gutil.log(scriptIds.length + ' Scripts updated:\n* ' + scriptIds.join('\n* ') + '\nrebuilding...');
			} else {
				gutil.log(scriptIds[0] + ' updated, rebuilding...');
			}
			rebundle();
		})
		.on('time', function (time) {
			gutil.log(chalk.green('Scripts built in ' + (Math.round(time / 10) / 100) + 's'));
		});

	function rebundle() {
		w.bundle()
			.on('error', function(e) {
 				gutil.log('Browserify Error', e);
 			})
 			.pipe(source('app.js'))
 			.pipe(gulp.dest('./public/build/js'));
	}

	return rebundle();

});
<commit_msg>remove refs to removed gulp testing modules<commit_after>var _ = require('underscore'),
	gulp = require('gulp'),
	gutil = require('gulp-util'),
	watch = require('gulp-watch'),
	browserify = require('browserify'),
	literalify = require('literalify'),
	watchify = require('watchify'),
	reactify = require('reactify'),
	source = require('vinyl-source-stream'),
	chalk = require('chalk'),
	del = require('del');

/**
 * Build Tasks
 */

// build scripts with browserify and react / jsx transforms
gulp.task('build-scripts', function() {
	return browserify({
			standalone: 'App'
		})
		.add('./admin/src/app.js')
		.transform(reactify)
		.transform(literalify.configure({
			tinymce: "window.tinymce"
		}))
		.bundle()
		.on('error', function(e) {
			gutil.log('Browserify Error', e);
		})
		.pipe(source('app.js'))
		.pipe(gulp.dest('./public/build/js'));
});

// watch scripts & build with debug features
gulp.task('watch-scripts', function() {

	var b = browserify(_.defaults({
			standalone: 'App'
		}, watchify.args))
		.add('./admin/src/app.js')
		.transform(reactify)
		.transform(literalify.configure({
			tinymce: "window.tinymce"
		}));

	var w = watchify(b)
		.on('update', function (scriptIds) {
			scriptIds = scriptIds
				.filter(function(i) { return i.substr(0,2) !== './' })
				.map(function(i) { return chalk.blue(i.replace(__dirname, '')) });
			if (scriptIds.length > 1) {
				gutil.log(scriptIds.length + ' Scripts updated:\n* ' + scriptIds.join('\n* ') + '\nrebuilding...');
			} else {
				gutil.log(scriptIds[0] + ' updated, rebuilding...');
			}
			rebundle();
		})
		.on('time', function (time) {
			gutil.log(chalk.green('Scripts built in ' + (Math.round(time / 10) / 100) + 's'));
		});

	function rebundle() {
		w.bundle()
			.on('error', function(e) {
 				gutil.log('Browserify Error', e);
 			})
 			.pipe(source('app.js'))
 			.pipe(gulp.dest('./public/build/js'));
	}

	return rebundle();

});
<|endoftext|>


<commit_before>'use strict';

var buffer = require('buffer');
var del = require('del');
var map = require('map-stream');

var gulp = require('gulp');
var gulpNodemon = require('gulp-nodemon');
var gulpJshint = require('gulp-jshint');
var gulpUglify = require('gulp-uglify');
var gulpWebserver = require('gulp-webserver');

//generate bookmark
gulp.task('generate-bookmarklet', function () {

	var header = new Buffer('javascript:');

	gulp.src('extension/style-validator.js')
		.pipe(gulpJshint())
		.pipe(gulpUglify())
		.pipe(map(function (file, cb) {
			file.contents = buffer.Buffer.concat([header, file.contents]);
			cb(null, file);
		}))
		.pipe(gulp.dest('bookmarklet'));
});

gulp.task('clean', del.bind(null, 'bookmarklet'));

gulp.task('watch', function () {
	var watcher = gulp.watch('extension/style-validator.js', ['generate-bookmarklet']);
	watcher.on('change', function(event) {
		console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});
});

//start server
gulp.task('start-node-server', function () {
	gulpNodemon({
		script: 'app.js',
		ext: 'html js'
	})
});

//open browser
gulp.task('open-browser', function () {
	gulp
		.src('../')
		.pipe(
			gulpWebserver({
				livereload: false,
				open: 'http://localhost:8000/Style-Validator/page/rules.html'
			})
		);
});

gulp.task('default', ['clean', 'generate-bookmarklet', 'watch', 'start-node-server', 'open-browser']);
<commit_msg>refactored<commit_after>'use strict';

var buffer = require('buffer');
var del = require('del');
var map = require('map-stream');

var gulp = require('gulp');
var gulpNodemon = require('gulp-nodemon');
var gulpJshint = require('gulp-jshint');
var gulpUglify = require('gulp-uglify');

//generate bookmark
gulp.task('generate-bookmarklet', function () {

	var header = new Buffer('javascript:');

	gulp.src('extension/style-validator.js')
		.pipe(gulpJshint())
		.pipe(gulpUglify())
		.pipe(map(function (file, cb) {
			file.contents = buffer.Buffer.concat([header, file.contents]);
			cb(null, file);
		}))
		.pipe(gulp.dest('bookmarklet'));
});

gulp.task('clean', del.bind(null, 'bookmarklet'));

gulp.task('watch', function () {
	var watcher = gulp.watch('extension/style-validator.js', ['generate-bookmarklet']);
	watcher.on('change', function(event) {
		console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});
});

//start server
gulp.task('start-server', function () {
	gulpNodemon({
		script: 'app.js',
		ext: 'html js'
	})
});
gulp.task('default', ['clean', 'generate-bookmarklet', 'watch', 'start-server']);
<|endoftext|>


<commit_before>var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();

var hbsfy = require('hbsfy');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var appDir = '.'
var dstDir = './build'

gulp.task('build:js', function() {
    return browserify(appDir + '/app.js')
        .transform(hbsfy)
        .bundle()
        .pipe(source('main.js'))
        .pipe(buffer())
        .pipe(plugins.uglify())
        .pipe(gulp.dest(dstDir + '/js'));
});

gulp.task('build:html', function() {
    return gulp.src(appDir + '/index.html')
        .pipe(gulp.dest(dstDir));
});

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

gulp.task('watch', ['build'], function() {
    gulp.watch(appDir + '/**/*.js', ['build:js'])
    gulp.watch(appDir + '/**/*.html', ['build:html'])
});

gulp.task('default', ['watch']);
<commit_msg>fix watch task in gulpfile<commit_after>var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();

var hbsfy = require('hbsfy');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');

var appDir = '.'
var dstDir = './build'

gulp.task('build:js', function() {
    return browserify(appDir + '/app.js')
        .transform(hbsfy)
        .bundle()
        .pipe(source('main.js'))
        .pipe(buffer())
        .pipe(plugins.uglify())
        .pipe(gulp.dest(dstDir + '/js'));
});

gulp.task('build:html', function() {
    return gulp.src(appDir + '/index.html')
        .pipe(gulp.dest(dstDir));
});

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

gulp.task('watch', ['build'], function() {
    gulp.watch(appDir + '/app.js', ['build:js'])
    gulp.watch(appDir + '/index.html', ['build:html'])
});

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


<commit_before>var gulp       = require('gulp');
var cleanCSS   = require('gulp-clean-css');
var sass       = require('gulp-sass');
var rename     = require('gulp-rename');
var autoprefix = require('gulp-autoprefixer');
var eslint     = require('gulp-eslint');
var qunit      = require('gulp-qunit');

var pack  = require('./package.json');
var utils = require('./config/utils.js');

gulp.task('compress', ['lint', 'commonjs', 'dev', 'production']);

gulp.task('lint', function() {
  return gulp.src(['src/**/*.js', 'test/*.js'])
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

gulp.task('commonjs', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.common.js',
    format: 'cjs'
  });
});

gulp.task('dev', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.js',
    format: 'umd'
  });
});

gulp.task('test', function() {
  return gulp.src('./test/test-runner.html')
    .pipe(qunit())
    .on('error', function(err){ // avoid the ugly error message on failing
      if (process.env.CI) { // but still fail if we're running in a CI
        throw err;
      }
      this.emit('end');
    });
});

gulp.task('production', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.min.js',
    format: 'umd',
    minify: true
  }).then(utils.zip);
});

gulp.task('sass', function() {
  gulp.src('src/sweetalert2.scss')
    .pipe(sass())
    .pipe(autoprefix())
    .pipe(gulp.dest('dist'))
    .pipe(cleanCSS())
    .pipe(rename({extname: '.min.css'}))
    .pipe(gulp.dest('dist'));

  gulp.src('docs/example.scss')
    .pipe(sass())
    .pipe(autoprefix())
    .pipe(gulp.dest('docs'));
});

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

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

  gulp.watch([
    'src/sweetalert2.scss',
    'docs/example.scss'
  ], ['sass', 'test']);
});
<commit_msg>Remove 'test' task from scss Gulp watcher<commit_after>var gulp       = require('gulp');
var cleanCSS   = require('gulp-clean-css');
var sass       = require('gulp-sass');
var rename     = require('gulp-rename');
var autoprefix = require('gulp-autoprefixer');
var eslint     = require('gulp-eslint');
var qunit      = require('gulp-qunit');

var pack  = require('./package.json');
var utils = require('./config/utils.js');

gulp.task('compress', ['lint', 'commonjs', 'dev', 'production']);

gulp.task('lint', function() {
  return gulp.src(['src/**/*.js', 'test/*.js'])
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

gulp.task('commonjs', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.common.js',
    format: 'cjs'
  });
});

gulp.task('dev', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.js',
    format: 'umd'
  });
});

gulp.task('test', function() {
  return gulp.src('./test/test-runner.html')
    .pipe(qunit())
    .on('error', function(err) { // avoid the ugly error message on failing
      if (process.env.CI) { // but still fail if we're running in a CI
        throw err;
      }
      this.emit('end');
    });
});

gulp.task('production', function() {
  return utils.packageRollup({
    dest: 'dist/' + pack.name + '.min.js',
    format: 'umd',
    minify: true
  }).then(utils.zip);
});

gulp.task('sass', function() {
  gulp.src('src/sweetalert2.scss')
    .pipe(sass())
    .pipe(autoprefix())
    .pipe(gulp.dest('dist'))
    .pipe(cleanCSS())
    .pipe(rename({extname: '.min.css'}))
    .pipe(gulp.dest('dist'));

  gulp.src('docs/example.scss')
    .pipe(sass())
    .pipe(autoprefix())
    .pipe(gulp.dest('docs'));
});

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

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

  gulp.watch([
    'src/sweetalert2.scss',
    'docs/example.scss'
  ], ['sass']);
});
<|endoftext|>


<commit_before>// grab our gulp packages
var gulp  = require("gulp");
var gutil = require("gulp-util");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var concat = require("gulp-concat");

gulp.task("concat", function() {
  return gulp.src(["bliss.shy.js", "bliss._.js"])
	.pipe(concat("bliss.js"))
	.pipe(gulp.dest("."));
});

gulp.task("minify", function() {
	var u = uglify();
	u.on("error", function(error) {
		console.error(error);
		u.end();
	});

	return gulp.src(["bliss.shy.js", "bliss.js"])
	.pipe(u)
	.pipe(rename({ suffix: ".min" }))
	.pipe(gulp.dest("."));
});

gulp.task("watch", function() {
	gulp.watch(["*.js", "!bliss.js", "!*.min.js"], ["concat", "minify"]);
});

gulp.task("default", gulp.series("concat", "minify"));
<commit_msg>Fix remaining gulp 3.x syntax<commit_after>// grab our gulp packages
var gulp  = require("gulp");
var gutil = require("gulp-util");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var concat = require("gulp-concat");

gulp.task("concat", function() {
  return gulp.src(["bliss.shy.js", "bliss._.js"])
	.pipe(concat("bliss.js"))
	.pipe(gulp.dest("."));
});

gulp.task("minify", function() {
	var u = uglify();
	u.on("error", function(error) {
		console.error(error);
		u.end();
	});

	return gulp.src(["bliss.shy.js", "bliss.js"])
	.pipe(u)
	.pipe(rename({ suffix: ".min" }))
	.pipe(gulp.dest("."));
});

gulp.task("watch", function() {
	gulp.watch(["*.js", "!bliss.js", "!*.min.js"], gulp.series("concat", "minify"));
});

gulp.task("default", gulp.series("concat", "minify"));
<|endoftext|>


<commit_before>const gulp = require('gulp')
const cssnano = require('cssnano')
const mqpacker = require('css-mqpacker')
const scss = require('postcss-scss')
const nested = require('postcss-nested')
const cssnext = require('postcss-cssnext')
const atImport = require('postcss-import')
const focus = require('postcss-focus')
const postcss = require('gulp-postcss')

gulp.task('css', () => {
  var processors = [
    atImport,
    cssnext({ browsers: ['last 2 versions'] }),
    focus,
    nested,
    mqpacker,
    cssnano({ autoprefixer: false })
  ]

  return gulp.src('src/css/main.css')
    .pipe(postcss(processors, { syntax: scss }))
    .pipe(gulp.dest('css'))
})

gulp.task('default')
<commit_msg>Update gulpfile.js<commit_after>const gulp = require('gulp')
const cssnano = require('cssnano')
const mqpacker = require('css-mqpacker')
const scss = require('postcss-scss')
const nested = require('postcss-nested')
const cssnext = require('postcss-cssnext')
const atImport = require('postcss-import')
const focus = require('postcss-focus')
const postcss = require('gulp-postcss')

gulp.task('css', () => {
  var processors = [
    atImport,
    cssnext({ browsers: ['last 2 versions'] }),
    focus,
    nested,
    mqpacker,
    cssnano({ autoprefixer: false })
  ]

  return gulp.src('src/css/main.css')
    .pipe(postcss(processors, { syntax: scss }))
    .pipe(gulp.dest('css'))
})

gulp.task('watch', () => gulp.watch('src/css/**/*.css', ['css']))

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


<commit_before>'use strict'

const { src, dest, watch, series, parallel } = require('gulp')
const gulpUglify = require('gulp-uglify')
const gulpSass = require('gulp-sass')
const del = require('del')

const SRC_DIR = 'src'
const BUILD_DIR = 'build'
const JS_FILES = `${SRC_DIR}/**/*.js`
const SASS_FILES = `${SRC_DIR}/**/*.scss`
const OTHER_FILES = [
  `${SRC_DIR}/{images,libs,fonts}/**`,
  `${SRC_DIR}/favicon.ico`,
  `${SRC_DIR}/index.html`,
]

const clean = async function() {
  await del(BUILD_DIR)
}

const uglify = function() {
  return src(JS_FILES)
    .pipe(gulpUglify())
    .pipe(dest(BUILD_DIR))
}

const sass = function() {
  return src(SASS_FILES)
    .pipe(
      gulpSass({ outputStyle: 'compressed' }).on('error', gulpSass.logError),
    )
    .pipe(dest(BUILD_DIR))
}

const move = function() {
  return src(OTHER_FILES).pipe(dest(BUILD_DIR))
}

const build = series(clean, move, parallel([uglify, sass]))

const watchTask = function() {
  return watch(`${SRC_DIR}/**`, build)
}

module.exports = {
  build,
  watch: watchTask,
}
<commit_msg>Add comment<commit_after>'use strict'

const { src, dest, watch, series, parallel } = require('gulp')
const gulpUglify = require('gulp-uglify')
const gulpSass = require('gulp-sass')
const del = require('del')

const SRC_DIR = 'src'
const BUILD_DIR = 'build'
const JS_FILES = `${SRC_DIR}/**/*.js`
const SASS_FILES = `${SRC_DIR}/**/*.scss`
const OTHER_FILES = [
  `${SRC_DIR}/{images,libs,fonts}/**`,
  `${SRC_DIR}/favicon.ico`,
  `${SRC_DIR}/index.html`,
]

const clean = async function() {
  // TODO: replace with `promisify(fs.rmdir)(..., {recursive: true})` after
  // dropping support for Node <12
  await del(BUILD_DIR)
}

const uglify = function() {
  return src(JS_FILES)
    .pipe(gulpUglify())
    .pipe(dest(BUILD_DIR))
}

const sass = function() {
  return src(SASS_FILES)
    .pipe(
      gulpSass({ outputStyle: 'compressed' }).on('error', gulpSass.logError),
    )
    .pipe(dest(BUILD_DIR))
}

const move = function() {
  return src(OTHER_FILES).pipe(dest(BUILD_DIR))
}

const build = series(clean, move, parallel([uglify, sass]))

const watchTask = function() {
  return watch(`${SRC_DIR}/**`, build)
}

module.exports = {
  build,
  watch: watchTask,
}
<|endoftext|>


<commit_before>/* jshint node: true */

var gulp = require('gulp'),
    gutil = require('gulp-util'),
    requirejs = require('gulp-requirejs'),
    uglify = require('gulp-uglify'),
    rename = require("gulp-rename"),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    jade = require('gulp-jade'),
    qunit = require('gulp-qunit'),
    watch = require('gulp-watch'),
    livereload = require('gulp-livereload')
    tinnylr = require('tiny-lr')

lr = tinnylr()
lr.listen(3456)

var exec = require("child_process").exec

var paths = {
  distRoot: './build',
  docsRoot: './docs',
  demosRoot: './docs/demos'
}

var pkg = {
  name: "bootstrap"
}

gulp.task('requirejs', function() {
  //目前requirejs还不支持gulp.src
  var jsDist = paths.distRoot + '/js/'
  var requirejsConfig= {
    baseUrl: "js",
    name: "almond",
    optimize: "none",
    include: pkg.name,
    insertRequire: [pkg.name],
    mainConfigFile: "js/requirejs-config.js",
    out: pkg.name + '.js',
    wrap: true
  }
  requirejs(requirejsConfig)
    //uncompressed
    .pipe(gulp.dest(jsDist))
    //uglify
    .pipe(uglify({preserveComments: 'some'}))
    .pipe(rename(pkg.name + '.min.js'))
    .pipe(gulp.dest(jsDist))
    .pipe(livereload(lr))
})

gulp.task('less', function() {
  var cssDist = paths.distRoot + '/css/'

  var recess = function(input, output) {
    output = output || input
    gulp.src('less/' + input + '.less')
      .pipe(less())
      .pipe(rename(output + '.css'))
      .pipe(gulp.dest(cssDist))
      .pipe(less({compress: true}))
      .pipe(rename(output + '.min.css'))
      .pipe(gulp.dest(cssDist))
      .pipe(livereload(lr))
  }

  recess('bootstrap')
  recess('responsive', pkg.name + '-responsive')
})

// compile jade template
gulp.task('jade', function() {
  gulp.src(['**/*.jade', '!base.jade', '!com-*', '!*-com.jade'],  {cwd: paths.demosRoot + '/templates/'})
    .pipe(jade())
    .pipe(gulp.dest(paths.demosRoot))
    .pipe(livereload(lr))
})

//compile mastache template
gulp.task('hogan', function(callback) {
  var child = exec('node docs/build', function(e) {
    callback()
  })
})

gulp.task('jshint', function() {
  var jsfiles = [
    'gulpfile.js',
    'js/*.js',
    'js/tests/unit/*.js'
  ]
  gulp.src(jsfiles)
    .pipe(jshint('js/.jshintrc'))
    .pipe(jshint.reporter('default'))
})

gulp.task('qunit', function() {
  var config = {
    inject: 'js/tests/unit/bootstrap-phantom.js'
  }
  gulp.src('js/tests/*.html')
    .pipe(qunit(config));
})

// copy fonts to build
gulp.task('fonts', function() {
  gulp.src('./fonts/*')
    .pipe(gulp.dest(paths.distRoot + '/fonts'))
})

gulp.task('livereload', function() {
  lr.changed({
    body: {
      files: ['nothing']
    }
  });
})

gulp.task('watch', function() {
  gulp.watch('js/**/*.js', ['requirejs'])
  gulp.watch('less/**/*.less', ['less'])
  gulp.watch(paths.docsRoot + '/templates/**/*.mustache', ['hogan'])
  gulp.watch(paths.demosRoot + '/templates/**/*.jade', ['jade'])
  gulp.watch('./fonts/*', ['jade'])
})

gulp.task('test', ['jshint'/*, 'qunit'*/])

gulp.task('docs', ['fonts', 'jade', 'hogan'])

gulp.task('default', ['less', 'test', 'requirejs', 'docs'])
<commit_msg>fix livereload<commit_after>/* jshint node: true */

var join = require("path").join

var gulp = require('gulp'),
    gutil = require('gulp-util'),
    requirejs = require('gulp-requirejs'),
    uglify = require('gulp-uglify'),
    rename = require("gulp-rename"),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    jade = require('gulp-jade'),
    qunit = require('gulp-qunit'),
    watch = require('gulp-watch'),
    livereload = require('gulp-livereload')
    tinnylr = require('tiny-lr')

var server = tinnylr()

var exec = require("child_process").exec

var paths = {
  distRoot: './build',
  docsRoot: './docs',
  demosRoot: './docs/demos'
}

var pkg = {
  name: "bootstrap"
}

gulp.task('requirejs', function() {
  //目前requirejs还不支持gulp.src
  var jsDist = join(paths.distRoot, 'js')
  var requirejsConfig= {
    baseUrl: "js",
    name: "almond",
    optimize: "none",
    include: pkg.name,
    insertRequire: [pkg.name],
    mainConfigFile: "js/requirejs-config.js",
    out: pkg.name + '.js',
    wrap: true
  }
  requirejs(requirejsConfig)
    //uncompressed
    .pipe(gulp.dest(jsDist))
    //uglify
    .pipe(uglify({preserveComments: 'some'}))
    .pipe(rename(pkg.name + '.min.js'))
    .pipe(gulp.dest(jsDist))
    .pipe(livereload(server))
})

gulp.task('less', function() {
  var cssDist = join(paths.distRoot, 'css')

  var recess = function(input, output) {
    output = output || input
    gulp.src(join('less', input + '.less'))
      .pipe(less())
      .pipe(rename(output + '.css'))
      .pipe(gulp.dest(cssDist))
      .pipe(less({compress: true}))
      .pipe(rename(output + '.min.css'))
      .pipe(gulp.dest(cssDist))
      .pipe(livereload(server))
  }

  recess('bootstrap')
  recess('responsive', pkg.name + '-responsive')
})

// compile jade template
gulp.task('jade', function() {
  gulp.src(['**/*.jade', '!base.jade', '!com-*', '!*-com.jade'],  {cwd: join(paths.demosRoot, 'templates')})
    .pipe(jade())
    .pipe(gulp.dest(paths.demosRoot))
    .pipe(livereload(server))
})

//compile mastache template
gulp.task('hogan', function(callback) {
  var child = exec('node docs/build', function(e) {
    callback()
  })
})

gulp.task('jshint', function() {
  var jsfiles = [
    'gulpfile.js',
    'js/*.js',
    'js/tests/unit/*.js'
  ]
  gulp.src(jsfiles)
    .pipe(jshint('js/.jshintrc'))
    .pipe(jshint.reporter('default'))
})

gulp.task('qunit', function() {
  var config = {
    inject: 'js/tests/unit/bootstrap-phantom.js'
  }
  gulp.src('js/tests/*.html')
    .pipe(qunit(config));
})

// copy fonts to build
gulp.task('fonts', function() {
  gulp.src('./fonts/*')
    .pipe(gulp.dest(join(paths.distRoot, 'fonts')))
})

gulp.task('watch', function() {
  server.listen(3456)
  gulp.watch('js/**/*.js', ['requirejs'])
  gulp.watch('less/**/*.less', ['less'])
  gulp.watch(join(paths.docsRoot, 'templates/**/*.mustache'), ['hogan'])
  gulp.watch(join(paths.demosRoot, 'templates/**/*.jade'), ['jade'])
  gulp.watch('./fonts/*', ['jade'])
})

gulp.task('test', ['jshint'/*, 'qunit'*/])

gulp.task('docs', ['fonts', 'jade', 'hogan'])

gulp.task('default', ['less', 'test', 'requirejs', 'docs'])
<|endoftext|>


<commit_before>var gulp = require('gulp'),
    connect = require('gulp-connect'),
    livereload = require('gulp-livereload'),
    sass = require('gulp-ruby-sass');

gulp.task('sass', function() {
  return sass('src/stylesheets/', {
    style: 'compressed',
    loadPath: [
      './src/stylesheets',
      './bower_components/bootstrap-sass-official/assets/stylesheets',
      './bower_components/fontawesome/scss'
    ]})
    .pipe(gulp.dest('build/css'))
    .pipe(livereload());
});

gulp.task('connect', function() {
  connect.server({
    port: 3005,
    root: 'build',
    livereload: true
  });
});

gulp.task('js', function () {
  gulp.src('./src/javascripts/*.js')
    .pipe(gulp.dest('./build/js'))
    .pipe(livereload());
});

gulp.task('html', function () {
  gulp.src('./src/*.html')
    .pipe(gulp.dest('./build'))
    .pipe(livereload());
});

gulp.task('watch', function () {
  livereload.listen();
  gulp.watch(['./src/stylesheets/*.scss'], ['sass']);
  gulp.watch(['./src/javascripts/*.js'], ['js']);
  gulp.watch(['./src/*.html'], ['html']);
});

gulp.task('icons', function() {
  return gulp.src('./bower_components/fontawesome/fonts/**.*')
    .pipe(gulp.dest('./build/fonts'));
});

gulp.task('default', ['connect', 'watch']);
<commit_msg>build html and css when loading gulp<commit_after>var gulp = require('gulp'),
    connect = require('gulp-connect'),
    livereload = require('gulp-livereload'),
    sass = require('gulp-ruby-sass');

gulp.task('sass', function() {
  return sass('src/stylesheets/', {
    style: 'compressed',
    loadPath: [
      './src/stylesheets',
      './bower_components/bootstrap-sass-official/assets/stylesheets',
      './bower_components/fontawesome/scss'
    ]})
    .pipe(gulp.dest('build/css'))
    .pipe(livereload());
});

gulp.task('connect', function() {
  connect.server({
    port: 3005,
    root: 'build',
    livereload: true
  });
});

gulp.task('js', function () {
  gulp.src('./src/javascripts/*.js')
    .pipe(gulp.dest('./build/js'))
    .pipe(livereload());
});

gulp.task('html', function () {
  gulp.src('./src/*.html')
    .pipe(gulp.dest('./build'))
    .pipe(livereload());
});

gulp.task('watch', function () {
  livereload.listen();
  gulp.watch(['./src/stylesheets/*.scss'], ['sass']);
  gulp.watch(['./src/javascripts/*.js'], ['js']);
  gulp.watch(['./src/*.html'], ['html']);
});

gulp.task('icons', function() {
  return gulp.src('./bower_components/fontawesome/fonts/**.*')
    .pipe(gulp.dest('./build/fonts'));
});

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


<commit_before>'use strict';

var gulp    = require('gulp'),
    traceur = require('gulp-traceur'),
    connect = require('gulp-connect'),
    open    = require('open');

gulp.task('connect', function () {
  var livereloadPort = 39729;

  connect.server({
    port: 8080,
    livereload: {
      port: livereloadPort
    },
    middleware: function (connect) {
      function mountFolder(connect, dir) {
        return connect.static(require('path').resolve(dir));
      }

      return [
        require('connect-livereload')({ port: livereloadPort }),
        mountFolder(connect, 'app')
      ];
    }
  });
});

gulp.task('watch', function () {
  gulp.watch([
    'app/**/*.html',
    'app/**/*.js',
    '!app/compiled/**'
  ], function (event) {
    return gulp.src(event.path)
      .pipe(connect.reload());
  });

  gulp.watch([
    'app/**/*.js'
  ], ['compile']);
});

gulp.task('compile', function () {
  return gulp.src([
      'app/**/*.js',
      '!app/compiled/**'
    ])
    .pipe(traceur())
    .pipe(gulp.dest('app/compiled'));
});

gulp.task('open', ['connect'], function () {
  require('open')('http://localhost:9421');
});

gulp.task('serve', function () {
  gulp.start('connect', 'watch', 'compile', 'open');
});
<commit_msg>Fix watcher<commit_after>'use strict';

var gulp    = require('gulp'),
    traceur = require('gulp-traceur'),
    connect = require('gulp-connect'),
    open    = require('open');

gulp.task('connect', function () {
  var livereloadPort = 39729;

  connect.server({
    port: 8080,
    livereload: {
      port: livereloadPort
    },
    middleware: function (connect) {
      function mountFolder(connect, dir) {
        return connect.static(require('path').resolve(dir));
      }

      return [
        require('connect-livereload')({ port: livereloadPort }),
        mountFolder(connect, 'node_modules/traceur/bin'),
        mountFolder(connect, 'app'),
      ];
    }
  });
});

gulp.task('watch', function () {
  gulp.watch([
    'app/**/*.html',
    'app/**/*.js',
    '!app/compiled/**'
  ], function (event) {
    return gulp.src(event.path)
      .pipe(connect.reload());
  });

  gulp.watch([
    'app/**/*.js'
  ], ['compile']);
});

gulp.task('compile', function () {
  return gulp.src([
      'app/**/*.js',
      '!app/compiled/**'
    ])
    .pipe(traceur())
    .pipe(gulp.dest('app/compiled'));
});

gulp.task('open', ['connect'], function () {
  require('open')('http://localhost:8080');
});

gulp.task('serve', function () {
  gulp.start('connect', 'watch', 'compile', 'open');
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var git = require('gulp-git');
var del = require('del');
var header = require('gulp-header');
var rename = require("gulp-rename");
var runSequence = require('run-sequence');

var pkg = require('./bower.json');
var banner = [
  '/**',
  ' * <%= pkg.name %> - <%= pkg.description %>',
  ' * @version v<%= pkg.version %>',
  ' * @copyright <%= pkg.authors %> ' + (new Date()).getFullYear(),
  ' * @license <%= pkg.license %>',
  ' */',
  ''
].join('\n');

var paths = {
  json: ['./bower.json', './package.json'],
  js: ['./src/extend.js']
};

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

gulp.task('bump-patch', function(){
  return gulp.src(paths.json)
    .pipe(bump())
    .pipe(gulp.dest('./'))
    .pipe(git.add())
    .pipe(git.commit('Bump version to ' + require('./bower.json').version));
});

gulp.task('bump-minor', function(){
  return gulp.src(paths.json)
    .pipe(bump({ type: 'minor' }))
    .pipe(gulp.dest('./'))
    .pipe(git.add())
    .pipe(git.commit('Bump version to ' + require('./bower.json').version));
});

gulp.task('bump-major', function(){
  return gulp.src(paths.json)
    .pipe(bump({ type: 'major' }))
    .pipe(gulp.dest('./'))
    .pipe(git.add())
    .pipe(git.commit('Bump version to ' + require('./bower.json').version));
});

gulp.task('tag', function() {
  git.tag('v' + require('./bower.json').version, function(err) {
    if (err) {
      throw err;
    }
  });
});

gulp.task('js', ['clean'], function() {
  return gulp.src(paths.js)
    .pipe(header(banner, { pkg : pkg }))
    .pipe(gulp.dest('./dist'));
});

gulp.task('js_min', ['clean'], function() {
  return gulp.src(paths.js)
    .pipe(uglify())
    .pipe(header(banner, { pkg : pkg }))
    .pipe(rename({ suffix: '.min' }))
    .pipe(gulp.dest('./dist'));
});

gulp.task('default', function(cb){
  runSequence('clean', ['js', 'js_min'], cb);
});
<commit_msg>update build<commit_after>var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var bump = require('gulp-bump');
var git = require('gulp-git');
var del = require('del');
var header = require('gulp-header');
var rename = require("gulp-rename");
var runSequence = require('run-sequence');

var pkg = require('./bower.json');
var banner = [
  '/**',
  ' * <%= pkg.name %> - <%= pkg.description %>',
  ' * @version v<%= pkg.version %>',
  ' * @copyright <%= pkg.authors %> ' + (new Date()).getFullYear(),
  ' * @license <%= pkg.license %>',
  ' */',
  ''
].join('\n');

var paths = {
  json: ['./bower.json', './package.json'],
  js: ['./src/extend.js']
};

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

gulp.task('bump-patch', function(){
  return gulp.src(paths.json)
    .pipe(bump())
    .pipe(gulp.dest('./'));
});

gulp.task('bump-minor', function(){
  return gulp.src(paths.json)
    .pipe(bump({ type: 'minor' }))
    .pipe(gulp.dest('./'));
});

gulp.task('bump-major', function(){
  return gulp.src(paths.json)
    .pipe(bump({ type: 'major' }))
    .pipe(gulp.dest('./'));
});

gulp.task('commit-bump', function() {
  return gulp.src(paths.json)
    .pipe(git.add())
    .pipe(git.commit('Bump version to ' + require('./bower.json').version));
});

gulp.task('tag', function() {
  git.tag('v' + require('./bower.json').version, function(err) {
    if (err) {
      throw err;
    }
  });
});

gulp.task('js', ['clean'], function() {
  return gulp.src(paths.js)
    .pipe(header(banner, { pkg : pkg }))
    .pipe(gulp.dest('./dist'));
});

gulp.task('js_min', ['clean'], function() {
  return gulp.src(paths.js)
    .pipe(uglify())
    .pipe(header(banner, { pkg : pkg }))
    .pipe(rename({ suffix: '.min' }))
    .pipe(gulp.dest('./dist'));
});

gulp.task('default', function(cb){
  runSequence('clean', ['js', 'js_min'], cb);
});
<|endoftext|>


<commit_before>// Module Dependencies
var cp          = require('child_process'),
    gulp        = require('gulp'),
    browserSync = require('browser-sync'),
    sass        = require('gulp-sass'),
    autoprefix  = require('gulp-autoprefixer');
    gutil       = require('gulp-util');
    argv        = require('minimist')(process.argv);
    gulpif      = require('gulp-if');
    prompt      = require('gulp-prompt');
    rsync       = require('gulp-rsync');

var paths = {
  siteDir: '_site/',
  sassDir: '_sass/',
  cssDir: 'assets/stylesheets/',
  jsDir: 'assets/javascripts/'
};

var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';

// Wait for jekyll:devbuild, then launch the Server
gulp.task('browser-sync', ['sass', 'jekyll:devbuild'], function () {
  browserSync({
    server: { baseDir: paths.siteDir },
    notify: false
  });
});

// Build the Jekyll Site for development
gulp.task('jekyll:devbuild', function (done) {
  return cp.spawn(jekyll, ['build', '--config', ['_config.yml', '_config.dev.yml']], {
      stdio: 'inherit'
    })
    .on('close', done);
});

// Build the Jekyll Site for production
gulp.task('jekyll:build', function (done) {
  return cp.spawn(jekyll, ['build'], {
      stdio: 'inherit'
    })
    .on('close', done);
});

// Rebuild Jekyll and reload page
gulp.task('jekyll:rebuild', ['jekyll:devbuild'], function () {
  browserSync.reload();
});

// Compile files from _scss into both _site/css (for live injecting)
// and site (for future jekyll builds)
gulp.task('sass', function () {
  return gulp
    .src(paths.sassDir + '*.scss')
    .pipe(sass({
        includePaths: [paths.sassDir]
      }))
    .on('error', sass.logError)
    .pipe(autoprefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {
        cascade: true
      }))
    .pipe(gulp.dest(paths.siteDir + paths.cssDir))
    .pipe(browserSync.reload({ stream: true }))
    .pipe(gulp.dest(paths.cssDir));
});

// Reload browsersync without rebuilding
gulp.task('reload', function () {
  browserSync.reload();
});

// Watch scss files for changes & recompile
// Watch html/md files, run jekyll & reload BrowserSync
gulp.task('watch', function () {
  gulp.watch(paths.sassDir + '**/*.scss', ['sass']);
  gulp.watch([
    '*.html',
    '_layouts/*.html',
    '_includes/**/*.html',
    '_posts/*.md',
    'assets/images/**/*',
    '*.yml'
  ], ['jekyll:rebuild']);
});

// Build site without starting server and watching for changes.
gulp.task('build', ['sass', 'jekyll:build']);

gulp.task('deploy', function() {

  // Dirs and Files to sync
  rsyncPaths = [paths.siteDir + '*.html', paths.siteDir + '**/*'];

  // Default options for rsync
  rsyncConf = {
    progress: true,
    root: "_site/",
    incremental: true,
    relative: true,
    emptyDirectories: true,
    recursive: true,
    clean: true,
    exclude: [],
  };

  // Staging
  if (argv.staging) {

    rsyncConf.hostname = 'new.codaye.com'; // hostname
    rsyncConf.username = 'codayetest'; // ssh username
    rsyncConf.destination = '/home/codayetest/new.codaye.com'; // path where uploaded files go

  // Production
  } else if (argv.production) {

    rsyncConf.hostname = ''; // hostname
    rsyncConf.username = ''; // ssh username
    rsyncConf.destination = ''; // path where uploaded files go

  // Missing/Invalid Target
  } else {
    throwError('deploy', gutil.colors.red('Missing or invalid target'));
  }

  // Use gulp-rsync to sync the files
  return gulp.src(rsyncPaths)
  .pipe(gulpif(
      argv.production,
      prompt.confirm({
        message: 'Heads Up! Are you SURE you want to push to PRODUCTION?',
        default: false
      })
  ))
  .pipe(rsync(rsyncConf));

});

function throwError(taskName, msg) {
  throw new gutil.PluginError({
      plugin: taskName,
      message: msg
    });
}

// Default task, running just `gulp` will compile the sass,
// compile the jekyll site, launch BrowserSync & watch files.
gulp.task('default', ['browser-sync', 'watch']);
<commit_msg>Add deploy details for prooduction server<commit_after>// Module Dependencies
var cp          = require('child_process'),
    gulp        = require('gulp'),
    browserSync = require('browser-sync'),
    sass        = require('gulp-sass'),
    autoprefix  = require('gulp-autoprefixer');
    gutil       = require('gulp-util');
    argv        = require('minimist')(process.argv);
    gulpif      = require('gulp-if');
    prompt      = require('gulp-prompt');
    rsync       = require('gulp-rsync');

var paths = {
  siteDir: '_site/',
  sassDir: '_sass/',
  cssDir: 'assets/stylesheets/',
  jsDir: 'assets/javascripts/'
};

var jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';

// Wait for jekyll:devbuild, then launch the Server
gulp.task('browser-sync', ['sass', 'jekyll:devbuild'], function () {
  browserSync({
    server: { baseDir: paths.siteDir },
    notify: false
  });
});

// Build the Jekyll Site for development
gulp.task('jekyll:devbuild', function (done) {
  return cp.spawn(jekyll, ['build', '--config', ['_config.yml', '_config.dev.yml']], {
      stdio: 'inherit'
    })
    .on('close', done);
});

// Build the Jekyll Site for production
gulp.task('jekyll:build', function (done) {
  return cp.spawn(jekyll, ['build'], {
      stdio: 'inherit'
    })
    .on('close', done);
});

// Rebuild Jekyll and reload page
gulp.task('jekyll:rebuild', ['jekyll:devbuild'], function () {
  browserSync.reload();
});

// Compile files from _scss into both _site/css (for live injecting)
// and site (for future jekyll builds)
gulp.task('sass', function () {
  return gulp
    .src(paths.sassDir + '*.scss')
    .pipe(sass({
        includePaths: [paths.sassDir]
      }))
    .on('error', sass.logError)
    .pipe(autoprefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], {
        cascade: true
      }))
    .pipe(gulp.dest(paths.siteDir + paths.cssDir))
    .pipe(browserSync.reload({ stream: true }))
    .pipe(gulp.dest(paths.cssDir));
});

// Reload browsersync without rebuilding
gulp.task('reload', function () {
  browserSync.reload();
});

// Watch scss files for changes & recompile
// Watch html/md files, run jekyll & reload BrowserSync
gulp.task('watch', function () {
  gulp.watch(paths.sassDir + '**/*.scss', ['sass']);
  gulp.watch([
    '*.html',
    '_layouts/*.html',
    '_includes/**/*.html',
    '_posts/*.md',
    'assets/images/**/*',
    '*.yml'
  ], ['jekyll:rebuild']);
});

// Build site without starting server and watching for changes.
gulp.task('build', ['sass', 'jekyll:build']);

gulp.task('deploy', function() {

  // Dirs and Files to sync
  rsyncPaths = [paths.siteDir + '*.html', paths.siteDir + '**/*'];

  // Default options for rsync
  rsyncConf = {
    progress: true,
    root: "_site/",
    incremental: true,
    relative: true,
    emptyDirectories: true,
    recursive: true,
    clean: true,
    exclude: [],
  };

  // Staging
  if (argv.staging) {

    rsyncConf.hostname = 'new.codaye.com'; // hostname
    rsyncConf.username = 'codayetest'; // ssh username
    rsyncConf.destination = '/home/codayetest/new.codaye.com'; // path where uploaded files go

  // Production
  } else if (argv.production) {

    rsyncConf.hostname = 'codaye.com'; // hostname
    rsyncConf.username = 'steama4'; // ssh username
    rsyncConf.destination = '/home/steama4/codaye.com'; // path where uploaded files go

  // Missing/Invalid Target
  } else {
    throwError('deploy', gutil.colors.red('Missing or invalid target'));
  }

  // Use gulp-rsync to sync the files
  return gulp.src(rsyncPaths)
  .pipe(gulpif(
      argv.production,
      prompt.confirm({
        message: 'Heads Up! Are you SURE you want to push to PRODUCTION?',
        default: false
      })
  ))
  .pipe(rsync(rsyncConf));

});

function throwError(taskName, msg) {
  throw new gutil.PluginError({
      plugin: taskName,
      message: msg
    });
}

// Default task, running just `gulp` will compile the sass,
// compile the jekyll site, launch BrowserSync & watch files.
gulp.task('default', ['browser-sync', 'watch']);
<|endoftext|>


<commit_before>var mandragora = require("mandragora-bucket/index.js"),
    gulp = require("gulp"),
    less = require("gulp-less");

mandragora(gulp, {
    paths: {
        bower: [
            "bower_components/purescript-*/src/**/*.purs",
            "bower_components/purescript-*/purescript-*/src/**/*.purs"
        ],
        test: ["test/**/*.purs"],
        src: ["src/**/*.purs"]
    },
    tmpDir: "tmp",
    entries: {
        "Entries.File": {
            "name": "file",
            "dir": "public"
        },
        "Entries.Notebook": {
            "name": "notebook",
            "dir": "public"
        }
    },
    docs: "MODULES.md",
    tmpDir: "dist"
});

gulp.task("less", function() {
    return gulp.src(["less/main.less"])
        .pipe(less({
            paths: ["less/**/*.less"]g
        }))
        .pipe(gulp.dest("public"));

});

gulp.task("watch-less", ["less"], function() {
    return gulp.watch(["less/**/*.less"],
                      ["less"]);
});

<commit_msg>typing error<commit_after>var mandragora = require("mandragora-bucket/index.js"),
    gulp = require("gulp"),
    less = require("gulp-less");

mandragora(gulp, {
    paths: {
        bower: [
            "bower_components/purescript-*/src/**/*.purs",
            "bower_components/purescript-*/purescript-*/src/**/*.purs"
        ],
        test: ["test/**/*.purs"],
        src: ["src/**/*.purs"]
    },
    tmpDir: "tmp",
    entries: {
        "Entries.File": {
            "name": "file",
            "dir": "public"
        },
        "Entries.Notebook": {
            "name": "notebook",
            "dir": "public"
        }
    },
    docs: "MODULES.md",
    tmpDir: "dist"
});

gulp.task("less", function() {
    return gulp.src(["less/main.less"])
        .pipe(less({
            paths: ["less/**/*.less"]
        }))
        .pipe(gulp.dest("public"));

});

gulp.task("watch-less", ["less"], function() {
    return gulp.watch(["less/**/*.less"],
                      ["less"]);
});

<|endoftext|>


<commit_before>'use strict';

var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var log = require('gulp-util').log;

var jshint = require('gulp-jshint');

var codeFiles = ['**/*.js', '!node_modules/**'];

gulp.task('lint', function() {
  log('Linting Files');
  return gulp.src(codeFiles)
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter());
});

gulp.task('jasmine', function() {
    gulp.src('spec/serpa-spec.js')
        .pipe(jasmine());
});

gulp.task('watch', function() {
  log('Watching Files');
  gulp.watch(codeFiles, ['lint', 'jasmine']);
});

gulp.task('default', ['jasmine', 'lint', 'watch']);
<commit_msg>chore(gulpfile): reload all files before testing<commit_after>'use strict';

var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var log = require('gulp-util').log;

var jshint = require('gulp-jshint');

var codeFiles = ['**/*.js', '!node_modules/**'];

gulp.task('lint', function() {
  log('Linting Files');
  return gulp.src(codeFiles)
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter());
});

gulp.task('jasmine', function() {
    gulp.src(codeFiles)
        .pipe(jasmine());
});

gulp.task('watch', function() {
  log('Watching Files');
  gulp.watch(codeFiles, ['lint', 'jasmine']);
});

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


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

// public/lib配下に展開したいnpmのパッケージ名
var modules = ['bootstrap-switch'];

gulp.task('export', function() {
  modules.map(function(name, index) {
    gulp.src('node_modules/' + name + '/**/*')
      .pipe(gulp.dest('public/packages/' + name));
  });
});

gulp.task('default', ['export']);
<commit_msg>modify: add description for export task<commit_after>var gulp = require('gulp');

// public/packages配下に展開したいnpmのパッケージ名
var modules = ['bootstrap-switch'];

// modulesで指定されたnpmライブラリをpublic/packages配下に展開する
gulp.task('export', function() {
  modules.map(function(name, index) {
    gulp.src('node_modules/' + name + '/**/*')
      .pipe(gulp.dest('public/packages/' + name));
  });
});

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


<commit_before>var browserify = require('browserify');
var buffer = require('vinyl-buffer');
var coveralls = require('gulp-coveralls');
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var nodemon = require('gulp-nodemon');
var sloc = require('gulp-sloc');
var source = require('vinyl-source-stream');
var spec = require('tap-spec');
var tape = require('gulp-tape');
var uglify = require('gulp-uglify');

var allJsFiles = [
  'src/*.js',
  'test/*.js',
  'gulpfile.js'
];

gulp.task('pre-test', function() {
  return gulp.src('src/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function() {
  return gulp.src('test/*.js')
    .pipe(tape({
      reporter: spec()
    }))
    .pipe(istanbul.writeReports());
});

gulp.task('watch', ['test'], function() {
  return nodemon({
    watch: ['src', 'test'],
    tasks: ['test'],
    verbose: false
  });
});

gulp.task('jscs', function() {
  return gulp.src(allJsFiles)
    .pipe(jscs())
    .pipe(jscs.reporter());
});

gulp.task('jshint', function() {
  return gulp.src(allJsFiles)
    .pipe(jshint())
    .pipe(jshint.reporter());
});

gulp.task('sloc', function() {
  return gulp.src(allJsFiles)
    .pipe(sloc());
});

gulp.task('coveralls', ['test'], function() {
  return gulp.src('coverage/lcov.info')
    .pipe(coveralls());
});

gulp.task('dist', function() {
  return browserify({
      entries: 'src/cron.js',
      standalone: 'Cron'
    })
    .bundle()
    .pipe(source('cron.min.js'))
    .pipe(buffer())
    .pipe(uglify())
    .pipe(gulp.dest('dist/'));
});

gulp.task('lint', ['sloc', 'jshint', 'jscs']);

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

gulp.task('travis', ['lint', 'coveralls']);

gulp.task('build', ['lint', 'test', 'dist']);
<commit_msg>Moved sloc from lint to travis task<commit_after>var browserify = require('browserify');
var buffer = require('vinyl-buffer');
var coveralls = require('gulp-coveralls');
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var nodemon = require('gulp-nodemon');
var sloc = require('gulp-sloc');
var source = require('vinyl-source-stream');
var spec = require('tap-spec');
var tape = require('gulp-tape');
var uglify = require('gulp-uglify');

var allJsFiles = [
  'src/*.js',
  'test/*.js',
  'gulpfile.js'
];

gulp.task('pre-test', function() {
  return gulp.src('src/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function() {
  return gulp.src('test/*.js')
    .pipe(tape({
      reporter: spec()
    }))
    .pipe(istanbul.writeReports());
});

gulp.task('watch', ['test'], function() {
  return nodemon({
    watch: ['src', 'test'],
    tasks: ['test'],
    verbose: false
  });
});

gulp.task('jscs', function() {
  return gulp.src(allJsFiles)
    .pipe(jscs())
    .pipe(jscs.reporter());
});

gulp.task('jshint', function() {
  return gulp.src(allJsFiles)
    .pipe(jshint())
    .pipe(jshint.reporter());
});

gulp.task('sloc', function() {
  return gulp.src(allJsFiles)
    .pipe(sloc());
});

gulp.task('coveralls', ['test'], function() {
  return gulp.src('coverage/lcov.info')
    .pipe(coveralls());
});

gulp.task('dist', function() {
  return browserify({
      entries: 'src/cron.js',
      standalone: 'Cron'
    })
    .bundle()
    .pipe(source('cron.min.js'))
    .pipe(buffer())
    .pipe(uglify())
    .pipe(gulp.dest('dist/'));
});

gulp.task('lint', ['jshint', 'jscs']);

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

gulp.task('travis', ['sloc', 'lint', 'coveralls']);

gulp.task('build', ['lint', 'test', 'dist']);
<|endoftext|>


<commit_before>var gulp = require('gulp');
var webpack = require('gulp-webpack');
var concat = require('gulp-concat');
var less = require('gulp-less');
var webpackConf = require('./webpack.config.js');
var babel = require('gulp-babel');
var connect = require('gulp-connect');

gulp.task("webpack", function() {
    return gulp.src('./examples/**/js/main.js')
        .pipe(webpack( webpackConf ))
        .pipe(concat('main.js'))
        .pipe(gulp.dest('../'))
        .pipe(connect.reload());
});

gulp.task('build-less', function(){
    return gulp.src('./src/less/**/*.less')
        .pipe(less())
        .pipe(gulp.dest('./dist/css'))
        .pipe(connect.reload());
});

gulp.task('build-less-example', function(){
    return gulp.src('./examples/**/less/**/*.less')
        .pipe(less())
        .pipe(gulp.dest('../'))
        .pipe(connect.reload());
});

gulp.task("connect", function(){
    connect.server({
        root: 'dist',
        livereload: true,
        port: 8003
      });
});

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

gulp.task('build', ['build-less', 'copy']);

gulp.task('default', ['build-less', 'babel', 'build-less-example', 'webpack']);

gulp.task('watch', function() {
    connect.server({
       root: 'examples/basic',
       livereload: true,
       port: 8003
     });
    gulp.watch('src/**/*.less', ['build-less']);
    gulp.watch(['src/**/*.js', 'src/**/*.jsx'], ['babel', 'webpack']);
    gulp.watch(['examples/**/js/**/*.js', 'examples/**/*.jsx'], ['webpack']);
    gulp.watch('examples/**/*.less', ['build-less-example']);
});
<commit_msg>Add umd support<commit_after>var gulp = require('gulp');
var webpack = require('gulp-webpack');
var concat = require('gulp-concat');
var less = require('gulp-less');
var webpackConf = require('./webpack.config.js');
var babel = require('gulp-babel');
var connect = require('gulp-connect');

gulp.task("webpack", function() {
    return gulp.src('./examples/**/js/main.js')
        .pipe(webpack( webpackConf ))
        .pipe(concat('main.js'))
        .pipe(gulp.dest('../'))
        .pipe(connect.reload());
});

gulp.task('build-less', function(){
    return gulp.src('./src/less/**/*.less')
        .pipe(less())
        .pipe(gulp.dest('./dist/css'))
        .pipe(connect.reload());
});

gulp.task('build-less-example', function(){
    return gulp.src('./examples/**/less/**/*.less')
        .pipe(less())
        .pipe(gulp.dest('../'))
        .pipe(connect.reload());
});

gulp.task("connect", function(){
    connect.server({
        root: 'dist',
        livereload: true,
        port: 8003
      });
});

gulp.task('babel', function(){
    return gulp.src('src/js/*.*')
        .pipe(babel({modules: 'umd'}))
        .pipe(gulp.dest('dist'));
});

gulp.task('build', ['build-less', 'copy']);

gulp.task('default', ['build-less', 'babel', 'build-less-example', 'webpack']);

gulp.task('watch', function() {
    connect.server({
       root: 'examples/basic',
       livereload: true,
       port: 8003
     });
    gulp.watch('src/**/*.less', ['build-less']);
    gulp.watch(['src/**/*.js', 'src/**/*.jsx'], ['babel', 'webpack']);
    gulp.watch(['examples/**/js/**/*.js', 'examples/**/*.jsx'], ['webpack']);
    gulp.watch('examples/**/*.less', ['build-less-example']);
});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var sass = require('gulp-sass');
var jsoncombine = require('gulp-jsoncombine');
var del = require('del');
var runSequence = require('run-sequence');

var paths = {
  files: ['images/**/*', 'js/**/*'],
  sass: 'sass/main.scss',
  manifest: 'manifest.json',
  ffmanifest: 'firefox-manifest.json',
  dest: {
    chrome: 'dist/chrome',
    firefox: 'dist/firefox'
  }
};

var ffmanifest = {
  "applications": {
    "gecko": {
      "id": "twitter-night-mode@mozilla.org"
    }
  }
}

function clean() {
  return del('dist');
}

function copyFiles() {
  return gulp.src(paths.files, { "base": "."})
          .pipe(gulp.dest(paths.dest.chrome))
          .pipe(gulp.dest(paths.dest.firefox));
}

function sassTask() {
  return gulp.src(paths.sass)
          .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
          .pipe(gulp.dest(paths.dest.chrome + '/css'))
          .pipe(gulp.dest(paths.dest.firefox + '/css'));
}

function firefoxManifest(data, meta) {
  data.manifest.applications = ffmanifest.applications;
  return new Buffer(JSON.stringify(data.manifest));
}

function copyManifest() {
  return gulp.src(paths.manifest)
          .pipe(gulp.dest(paths.dest.chrome))
          .pipe(jsoncombine('manifest.json', firefoxManifest))
          .pipe(gulp.dest(paths.dest.firefox));
}

gulp.task('clean', clean);

gulp.task('copy', copyFiles);

gulp.task('sass', sassTask);

gulp.task('manifest', copyManifest);

gulp.task('default', function(done) {
  runSequence('clean', 'copy', 'sass', 'manifest', done);
});<commit_msg>add gulp watch task - finally :grin:<commit_after>var gulp = require('gulp');
var sass = require('gulp-sass');
var jsoncombine = require('gulp-jsoncombine');
var del = require('del');
var runSequence = require('run-sequence');

var paths = {
  files: ['images/**/*', 'js/**/*'],
  sass: 'sass/main.scss',
  manifest: 'manifest.json',
  ffmanifest: 'firefox-manifest.json',
  dest: {
    chrome: 'dist/chrome',
    firefox: 'dist/firefox'
  }
};

var ffmanifest = {
  "applications": {
    "gecko": {
      "id": "twitter-night-mode@mozilla.org"
    }
  }
}

function clean() {
  return del('dist');
}

function copyFiles() {
  return gulp.src(paths.files, { "base": "."})
          .pipe(gulp.dest(paths.dest.chrome))
          .pipe(gulp.dest(paths.dest.firefox));
}

function sassTask() {
  return gulp.src(paths.sass)
          .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
          .pipe(gulp.dest(paths.dest.chrome + '/css'))
          .pipe(gulp.dest(paths.dest.firefox + '/css'));
}

function firefoxManifest(data, meta) {
  data.manifest.applications = ffmanifest.applications;
  return new Buffer(JSON.stringify(data.manifest));
}

function copyManifest() {
  return gulp.src(paths.manifest)
          .pipe(gulp.dest(paths.dest.chrome))
          .pipe(jsoncombine('manifest.json', firefoxManifest))
          .pipe(gulp.dest(paths.dest.firefox));
}

gulp.task('clean', clean);

gulp.task('copy', copyFiles);

gulp.task('sass', sassTask);

gulp.task('manifest', copyManifest);

gulp.task('default', function(done) {
  runSequence('clean', 'copy', 'sass', 'manifest', done);
});

gulp.task('watch', function() {
  gulp.watch(['sass/**/*.scss', 'js/**/*.js', 'images/**/*', 'manifest.json'], ['default']);
});<|endoftext|>


<commit_before>const gulp = require('gulp')
const sass = require('gulp-sass')
const livereload = require('gulp-livereload')
const concat = require('gulp-concat')
const rollup = require('gulp-rollup')
const uglify = require('gulp-uglify')
const nodemon = require('gulp-nodemon')

const babel = require('rollup-plugin-babel')
const npm = require('rollup-plugin-npm')
const commonjs = require('rollup-plugin-commonjs')

const dirs = {
  sass: 'build/styles/*.scss',
  js: 'build/scripts/**/*.js',
  vectors: 'build/vectors/*'
}

gulp.task('styles', function () {
  return gulp.src(dirs.sass)
    .pipe(concat('styles.scss'))
    .pipe(sass({
      outputStyle: 'compressed',
      includePaths: ['build/styles']
    }).on('error', sass.logError))
    .pipe(gulp.dest('dist'))
    .pipe(livereload())
})

gulp.task('scripts', function () {
  return gulp.src('build/scripts/app.js', { read: false })
    .pipe(rollup({
      plugins: [
        babel({
          presets: ['es2015-rollup']
        }),
        npm({
          main: true,
          jsnext: true
        }),
        commonjs({
          include: 'node_modules/**',
          exclude: '**/*.css'
        })
      ]
    })).on('error', console.error)
    .pipe(uglify())
    .pipe(gulp.dest('dist'))
    .pipe(livereload())
})

gulp.task('server', ['watch'], function () {
  nodemon({
    script: 'index.js',
    ignore: ['build/', 'dist/'],
    ext: 'js hbs'
  }).on('restart', function () {
    process.env.restarted = true
  })
})

gulp.task('watch', function () {
  livereload.listen()

  gulp.watch(dirs.sass, ['styles'])
  gulp.watch(dirs.js, ['scripts'])
})

gulp.task('default', ['styles', 'scripts'])
<commit_msg>Adjusted gulp tasks<commit_after>const gulp = require('gulp')
const sass = require('gulp-sass')
const livereload = require('gulp-livereload')
const concat = require('gulp-concat')
const rollup = require('gulp-rollup')
const uglify = require('gulp-uglify')
const nodemon = require('gulp-nodemon')

const babel = require('rollup-plugin-babel')
const npm = require('rollup-plugin-npm')
const commonjs = require('rollup-plugin-commonjs')

const dirs = {
  scss: 'assets/scss/**/*.scss',
  js: 'assets/js/**/*.js',
  images: 'assets/images/**/*'
}

gulp.task('styles', () => {
  return gulp
    .src(dirs.scss)
    .pipe(concat('styles.scss'))
    .pipe(sass({
      outputStyle: 'compressed',
      includePaths: ['assets/scss']
    }).on('error', sass.logError))
    .pipe(gulp.dest('dist'))
    .pipe(livereload())
})

gulp.task('scripts', () => {
  return gulp
    .src('assets/js/app.js', { read: false })
    .pipe(rollup({
      plugins: [
        babel({
          presets: ['es2015-rollup']
        }),
        npm({
          main: true,
          jsnext: true
        }),
        commonjs({
          include: 'node_modules/**',
          exclude: '**/*.css'
        })
      ]
    })).on('error', console.error)
    .pipe(uglify())
    .pipe(gulp.dest('dist'))
    .pipe(livereload())
})

gulp.task('images', () => {
  return gulp
    .src(dirs.images)
    .pipe(gulp.dest('dist/images'))
})

gulp.task('server', ['watch'], () => {
  nodemon({
    script: 'index.js',
    ignore: ['assets/', 'dist/'],
    ext: 'js hbs'
  }).on('restart', function () {
    process.env.restarted = true
  })
})

gulp.task('watch', () => {
  livereload.listen()

  gulp.watch(dirs.scss, ['styles'])
  gulp.watch(dirs.js, ['scripts'])
  gulp.watch(dirs.images, ['images'])
})

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


<commit_before>var gulp        = require('gulp');
var uncss       = require('gulp-uncss');
var uglify      = require('gulp-uglify');
var nano        = require('gulp-cssnano');
var usemin      = require('gulp-usemin');
var tsc         = require('gulp-typescript');
var typings     = require('gulp-typings');
var install     = require('gulp-install');
var realFavicon = require ('gulp-real-favicon');
var fs          = require('fs');

var FAVICON_DATA_FILE = 'faviconData.json';

gulp.task('generate-favicon', function(done) {
	realFavicon.generateFavicon({
		masterPicture: './crypt.png',
		dest: 'dist/client/favicons',
		iconsPath: '/favicons',
		design: {
			ios: {
				pictureAspect: 'backgroundAndMargin',
				backgroundColor: '#352f2f',
				margin: '21%'
			},
			desktopBrowser: {},
			windows: {
				pictureAspect: 'noChange',
				backgroundColor: '#352f2f',
				onConflict: 'override'
			},
			androidChrome: {
				pictureAspect: 'backgroundAndMargin',
				margin: '17%',
				backgroundColor: '#352f2f',
				themeColor: '#ffffff',
				manifest: {
					name: 'Crypt',
					display: 'browser',
					orientation: 'notSet',
					onConflict: 'override',
					declared: true
				}
			},
			safariPinnedTab: {
				pictureAspect: 'silhouette',
				themeColor: '#01cccc'
			}
		},
		settings: {
			compression: 5,
			scalingAlgorithm: 'Cubic',
			errorOnImageTooSmall: false
		},
		markupFile: FAVICON_DATA_FILE
	}, function() {
		done();
	});
});

gulp.task('inject-favicon-markups', ['generate-favicon', 'copy_client_root'],function() {
	gulp.src('dist/client/index.html')
		.pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
		.pipe(gulp.dest('dist/client/'));
});

gulp.task('check-for-favicon-update', function(done) {
	var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
	realFavicon.checkForUpdates(currentVersion, function(err) {
		if (err) {
			throw err;
		}
	});
});

gulp.task('tscompile', function(){
  var tsProject = tsc.createProject('src/client/tsconfig.json', {
    "target": "es3",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  });
  return tsProject.src().pipe(tsc(tsProject)).js.pipe(gulp.dest('dist/client/app'));
});

gulp.task('usemin', function(){
  return gulp.src('src/client/index.html')
    .pipe(usemin({
        js: [uglify(), 'concat'],
        css: [uncss({html:['src/client/index.html', 'src/client/templates/*.html'], ignore:[]}), nano(), 'concat']
      })
    )
    .pipe(gulp.dest('dist/client'));
});

gulp.task('copy_templates', function(){
  return gulp.src(['src/client/templates/*.html'])
      .pipe(gulp.dest('dist/client/templates'));
});

gulp.task('copy_client_root', function(){
  return gulp.src(['src/client/favicon.ico', 'src/client/index.html', 'src/client/package.json', 'src/client/typings.json', 'src/client/systemjs.config.js'])
      .pipe(gulp.dest('dist/client/'));
});

gulp.task('copy_node', function(){
  return gulp.src(['src/**/*', '!src/client/**/*', './package.json', '!./node_modules', '!./config.json'])
      .pipe(gulp.dest('dist/'));
});

gulp.task('install_api', ['copy_node'], function(){
  return gulp.src('dist/package.json')
    .pipe(install({production:true, ignoreScripts:true}));
});

gulp.task('install_client', ['copy_client_root'], function(){
  return gulp.src('dist/client/package.json')
    .pipe(install({production:true, ignoreScripts:true}));
});

gulp.task('install_client_typings', ['copy_client_root', 'install_client'], function(){
  return gulp.src('dist/client/typings.json')
    .pipe(typings());
});

gulp.task('watch', function(){
  console.log('watching for changes...');
  gulp.watch(['src/client/src/**/*.ts'], ['tscompile']);
  gulp.watch(['src/client/**/*.html'], ['copy_client_root', 'copy_templates']);
  gulp.watch(['./crypt.png'], ['inject-favicon-markups']);
  gulp.watch(['src/**/*', '!src/client/**/*'], ['copy_node']);
  gulp.watch(['./package.json'], ['install_api']);
  return gulp.watch(['src/client/package.json'], ['install_client']);
});

// Default Task
gulp.task('default', ['copy_node', 'copy_client_root', 'copy_templates', 'tscompile', 'install_api', 'install_client', 'install_client_typings']);
<commit_msg>adjust to es5 since most packages wont work below that<commit_after>var gulp        = require('gulp');
var uncss       = require('gulp-uncss');
var uglify      = require('gulp-uglify');
var nano        = require('gulp-cssnano');
var usemin      = require('gulp-usemin');
var tsc         = require('gulp-typescript');
var typings     = require('gulp-typings');
var install     = require('gulp-install');
var realFavicon = require ('gulp-real-favicon');
var fs          = require('fs');

var FAVICON_DATA_FILE = 'faviconData.json';

gulp.task('generate-favicon', function(done) {
	realFavicon.generateFavicon({
		masterPicture: './crypt.png',
		dest: 'dist/client/favicons',
		iconsPath: '/favicons',
		design: {
			ios: {
				pictureAspect: 'backgroundAndMargin',
				backgroundColor: '#352f2f',
				margin: '21%'
			},
			desktopBrowser: {},
			windows: {
				pictureAspect: 'noChange',
				backgroundColor: '#352f2f',
				onConflict: 'override'
			},
			androidChrome: {
				pictureAspect: 'backgroundAndMargin',
				margin: '17%',
				backgroundColor: '#352f2f',
				themeColor: '#ffffff',
				manifest: {
					name: 'Crypt',
					display: 'browser',
					orientation: 'notSet',
					onConflict: 'override',
					declared: true
				}
			},
			safariPinnedTab: {
				pictureAspect: 'silhouette',
				themeColor: '#01cccc'
			}
		},
		settings: {
			compression: 5,
			scalingAlgorithm: 'Cubic',
			errorOnImageTooSmall: false
		},
		markupFile: FAVICON_DATA_FILE
	}, function() {
		done();
	});
});

gulp.task('inject-favicon-markups', ['generate-favicon', 'copy_client_root'],function() {
	gulp.src('dist/client/index.html')
		.pipe(realFavicon.injectFaviconMarkups(JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code))
		.pipe(gulp.dest('dist/client/'));
});

gulp.task('check-for-favicon-update', function(done) {
	var currentVersion = JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).version;
	realFavicon.checkForUpdates(currentVersion, function(err) {
		if (err) {
			throw err;
		}
	});
});

gulp.task('tscompile', function(){
  var tsProject = tsc.createProject('src/client/tsconfig.json', {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  });
  return tsProject.src().pipe(tsc(tsProject)).js.pipe(gulp.dest('dist/client/app'));
});

gulp.task('usemin', function(){
  return gulp.src('src/client/index.html')
    .pipe(usemin({
        js: [uglify(), 'concat'],
        css: [uncss({html:['src/client/index.html', 'src/client/templates/*.html'], ignore:[]}), nano(), 'concat']
      })
    )
    .pipe(gulp.dest('dist/client'));
});

gulp.task('copy_templates', function(){
  return gulp.src(['src/client/templates/*.html'])
      .pipe(gulp.dest('dist/client/templates'));
});

gulp.task('copy_client_root', function(){
  return gulp.src(['src/client/favicon.ico', 'src/client/index.html', 'src/client/package.json', 'src/client/typings.json', 'src/client/systemjs.config.js'])
      .pipe(gulp.dest('dist/client/'));
});

gulp.task('copy_node', function(){
  return gulp.src(['src/**/*', '!src/client/**/*', './package.json', '!./node_modules', '!./config.json'])
      .pipe(gulp.dest('dist/'));
});

gulp.task('install_api', ['copy_node'], function(){
  return gulp.src('dist/package.json')
    .pipe(install({production:true, ignoreScripts:true}));
});

gulp.task('install_client', ['copy_client_root'], function(){
  return gulp.src('dist/client/package.json')
    .pipe(install({production:true, ignoreScripts:true}));
});

gulp.task('install_client_typings', ['copy_client_root', 'install_client'], function(){
  return gulp.src('dist/client/typings.json')
    .pipe(typings());
});

gulp.task('watch', function(){
  console.log('watching for changes...');
  gulp.watch(['src/client/src/**/*.ts'], ['tscompile']);
  gulp.watch(['src/client/**/*.html'], ['copy_client_root', 'copy_templates']);
  gulp.watch(['./crypt.png'], ['inject-favicon-markups']);
  gulp.watch(['src/**/*', '!src/client/**/*'], ['copy_node']);
  gulp.watch(['./package.json'], ['install_api']);
  return gulp.watch(['src/client/package.json'], ['install_client']);
});

// Default Task
gulp.task('default', ['copy_node', 'copy_client_root', 'copy_templates', 'inject-favicon-markups', 'tscompile', 'install_api', 'install_client', 'install_client_typings']);
<|endoftext|>


<commit_before>var gulp   = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var wrap   = require('gulp-wrap');
var del = require('del');
var nib    = require('nib');
var stylus = require('gulp-stylus');

gulp.task('javascript', function() {
  return gulp.src('assets/javascript/*.js')
    .pipe(concat('main.js'))
    .pipe(wrap('(function(a, window){<%= contents %>}(angular, window));'))
    .pipe(gulp.dest('public/javascript'))
    .pipe(rename({
      suffix: '.min'
    }))
    .pipe(uglify())
    .pipe(gulp.dest('public/javascript'))
    .pipe(notify({ message: 'Scripts task complete' }));
});

gulp.task('css', function() {
  return gulp.src('assets/style/*.styl')
    .pipe(stylus({
      use: nib()
    }))
    .pipe(gulp.dest('public/css'))
    .pipe(notify({ message: 'CSS task complete' }));
});

gulp.task('default', function() {
  gulp.start('javascript');
	gulp.start('css');
});

gulp.task('watch', function() {
  gulp.watch('assets/javascript/*.js', ['javascript']);
	gulp.watch('assets/style/*.styl', ['css']);
});
<commit_msg>Update gulpfile.js<commit_after>var gulp   = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var wrap   = require('gulp-wrap');
var del = require('del');
var nib    = require('nib');
var stylus = require('gulp-stylus');

gulp.task('javascript', function() {
  return gulp.src('assets/javascript/*.js')
    .pipe(concat('main.js'))
    .pipe(wrap('(function(a, window){<%= contents %>}(angular, window));'))
    .pipe(gulp.dest('public/javascript'))
    .pipe(rename({
      suffix: '.min'
    }))
    .pipe(uglify())
    .pipe(gulp.dest('public/javascript'))
    .pipe(notify({ message: 'Scripts task complete' }));
});

gulp.task('css', function() {
  return gulp.src('assets/style/*.styl')
    .pipe(stylus({
      use: nib()
    }))
    .pipe(gulp.dest('public/css'))
    .pipe(notify({ message: 'CSS task complete' }));
});

gulp.task('default', function() {
  gulp.start('javascript');
  gulp.start('css');
});

gulp.task('watch', function() {
  gulp.watch('assets/javascript/*.js', ['javascript']);
  gulp.watch('assets/style/*.styl', ['css']);
});
<|endoftext|>


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

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var bower_components = require('main-bower-files')();

var newenv = process.env;
var gpm_dir = __dirname + path.sep + '.godeps';
if (newenv.GOPATH.split(path.delimiter).indexOf(gpm_dir) == -1) {
  newenv.GOPATH = gpm_dir + path.delimiter + newenv.GOPATH;
}

gulp.task('css', function() {
  return gulp.src(bower_components)
    .pipe($.filter('**/*.css'))
    .pipe($.concat('main.css'))
    .pipe($.minifyCss())
    .pipe(gulp.dest('./public'));
});

gulp.task('js', function() {
  return gulp.src(bower_components)
    .pipe($.filter('**/*.js'))
    .pipe($.concat('main.js'))
    .pipe($.uglify())
    .pipe(gulp.dest('./public'));
});

gulp.task('go', function() {
  return $.run('go build', {env: newenv}).exec();
});

gulp.task('default', function() {
  // place code for your default task here
});
<commit_msg>Refactor GOPATH calculation in gulpfile<commit_after>var path = require('path');

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var bower_components = require('main-bower-files')();

var gopath = function() {
  var gpm_dir = __dirname + path.sep + '.godeps';
  if (process.env.GOPATH.split(path.delimiter).indexOf(gpm_dir) != -1) {
    return process.env.GOPATH;
  }
  return gpm_dir + path.delimiter + process.env.GOPATH;
}

gulp.task('css', function() {
  return gulp.src(bower_components)
    .pipe($.filter('**/*.css'))
    .pipe($.concat('main.css'))
    .pipe($.minifyCss())
    .pipe(gulp.dest('./public'));
});

gulp.task('js', function() {
  return gulp.src(bower_components)
    .pipe($.filter('**/*.js'))
    .pipe($.concat('main.js'))
    .pipe($.uglify())
    .pipe(gulp.dest('./public'));
});

gulp.task('go', function() {
  var newenv = process.env;
  newenv.GOPATH = gopath();
  return $.run('go build', {env: newenv}).exec();
});

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


<commit_before>// jchck_'s gulpfile

//
// gulp plugin registry
//

var gulp 			=		require('gulp');
var postcss 		=		require('gulp-postcss');
var cssnext 		= 		require('postcss-cssnext');
var precss			=		require('precss');
var autoprefixer	=		require('autoprefixer');
var atImport		=		require('postcss-import');
var mqpacker		=		require('css-mqpacker');
var cssnano			=		require('cssnano');
var size			=		require('gulp-size');
var	cssvariables	=		require('postcss-css-variables');
var browserSync		=		require('browser-sync').create();
var devUrl			=		'http://vagrant.local/jchck/';

//
// css processing task
//
// $ gulp css
//

gulp.task('css', function(){

	// postcss plugin registry
	var postcssPlugins = [
		atImport,
		cssvariables,
		cssnano,
		autoprefixer({
			browsers: ['last 2 versions']
		}),
		cssnext,
		mqpacker,
		precss
	];

	// processing plumbing
	return gulp.src('./src/css/jchck_.css')

		// postcss it
		.pipe(postcss(postcssPlugins))

		// what's the size?
		.pipe(size({gzip: false, showFiles: true, title: 'Processed!'}))
		.pipe(size({gzip: true, showFiles: true, title: 'Processed & gZipped!'}))

		// spit it out
		.pipe(gulp.dest('./dest'))

		.pipe(browserSync.stream());
});

//
// watch task
//
// $ gulp watch
//

gulp.task('watch', function(){

	browserSync.init({

		// the php files to watch
		files: [
			'{lib,templates}/**/*.php',
			'*.php'
		],

		// the url getting proxied, defined above
		proxy: devUrl,

		// @see https://www.browsersync.io/docs/options/#option-snippetOptions
		snippetOptions: {
			whitelist: ['/wp-admin/admin-ajax.php'],
			blacklist: ['/wp-admin/**']
		}
	});

	// the css files to watch on change runs the css processing task
	gulp.watch(['./src/css/*'], ['css']);
});

<commit_msg>write the default gulp task<commit_after>// jchck_'s gulpfile

//
// gulp plugin registry
//

var gulp 			=		require('gulp');
var postcss 		=		require('gulp-postcss');
var cssnext 		= 		require('postcss-cssnext');
var precss			=		require('precss');
var autoprefixer	=		require('autoprefixer');
var atImport		=		require('postcss-import');
var mqpacker		=		require('css-mqpacker');
var cssnano			=		require('cssnano');
var size			=		require('gulp-size');
var	cssvariables	=		require('postcss-css-variables');
var browserSync		=		require('browser-sync').create();
var devUrl			=		'http://vagrant.local/jchck/';

//
// css processing task
//
// $ gulp css
//

gulp.task('css', function(){

	// postcss plugin registry
	var postcssPlugins = [
		atImport,
		cssvariables,
		cssnano,
		autoprefixer({
			browsers: ['last 2 versions']
		}),
		cssnext,
		mqpacker,
		precss
	];

	// processing plumbing
	return gulp.src('./src/css/jchck_.css')

		// postcss it
		.pipe(postcss(postcssPlugins))

		// what's the size?
		.pipe(size({gzip: false, showFiles: true, title: 'Processed!'}))
		.pipe(size({gzip: true, showFiles: true, title: 'Processed & gZipped!'}))

		// spit it out
		.pipe(gulp.dest('./dest'))

		.pipe(browserSync.stream());
});

//
// watch task
//
// $ gulp watch
//

gulp.task('watch', function(){

	browserSync.init({

		// the php files to watch
		files: [
			'{lib,templates}/**/*.php',
			'*.php'
		],

		// the url getting proxied, defined above
		proxy: devUrl,

		// @see https://www.browsersync.io/docs/options/#option-snippetOptions
		snippetOptions: {
			whitelist: ['/wp-admin/admin-ajax.php'],
			blacklist: ['/wp-admin/**']
		}
	});

	// the css files to watch on change runs the css processing task
	gulp.watch(['./src/css/*'], ['css']);
});

//
// default task
//
// $ gulp
//

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


<commit_before>var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var tinyLr = require('tiny-lr')();
var wiredep = require('wiredep').stream;

var config = require('./build.conf.js');
var lrPort = 35728;

gulp.task('install:client:css', function () {
  return gulp.src(config.frontendSource.scss)
    .pipe($.plumber())
    .pipe($.sourcemaps.init())
    .pipe($.sass())
    .pipe($.sourcemaps.write())
    .pipe($.concatCss('style.css'))
    .pipe(gulp.dest(config.frontendTarget.css))
    .pipe($.livereload(tinyLr));
});

gulp.task('install:client:partials', function () {
  return gulp.src(config.frontendSource.partials)
    .pipe($.plumber())
    .pipe($.ngHtml2js({
      moduleName: 'app.partials'
    }))
    .pipe($.concat('partials.js'))
    .pipe(gulp.dest(config.frontendTarget.js))
    .pipe($.livereload(tinyLr));
});

gulp.task('install:client:code', function () {
  return gulp.src(config.frontendSource.code)
    .pipe($.plumber())
    .pipe($.wrap('(function (angular) {\n<%= contents %>\n}(angular));'))
    .pipe($.sourcemaps.init())
    .pipe($.concat('scripts.js'))
    .pipe($.sourcemaps.write())
    .pipe(gulp.dest(config.frontendTarget.js))
    .pipe($.livereload(tinyLr));
});

gulp.task('install:client:assets', function () {
  return gulp.src(config.frontendSource.assets)
    .pipe($.plumber())
    .pipe(gulp.dest(config.frontendTarget.assets))
    .pipe($.livereload(tinyLr));
});

gulp.task('install:client:html', function () {
  return gulp.src(config.frontendSource.html)
    .pipe($.plumber())
    .pipe(wiredep({
      ignorePath: '.' + config.frontendTarget.html
    }))
    .pipe(gulp.dest(config.frontendTarget.html))
    .pipe($.livereload(tinyLr))
});

gulp.task('client:test', [ 'install' ], function () {
  return gulp.src(config.frontendSource.test)
    .pipe($.karma({
      configFile: 'karma.conf.js',
      action: 'run'
    }))
    .on('error', function (err) {
      throw err;
    });
});

gulp.task('client:test:watch', function () {
  return gulp.src(config.frontendSource.test)
    .pipe($.karma({
      configFile: 'karma.conf.js',
      action: 'watch'
    }));
});

gulp.task('jshint', function () {
  return gulp.src(config.backendSource.code.concat(config.frontendSource.code))
    .pipe($.plumber())
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
});

gulp.task('jsonlint', function () {
  return gulp.src(config.frontendSource.i18n)
    .pipe($.plumber())
    .pipe($.jsonlint())
    .pipe($.jsonlint.reporter());
});

gulp.task('server:test', function () {
  return gulp.src(config.backendSource.test, { read: false })
    .pipe($.plumber())
    .pipe($.mocha({ reporter: 'spec' }));
});

gulp.task('serve', function () {
  $.nodemon({script: 'server/server.js', ignore: ['node_modules/**/*.js']})
    .on('restart', function () {
      $.livereload(tinyLr);
    });
});

gulp.task('live', function () {
  tinyLr.listen(lrPort, function (err) {
    if (err) {
      return console.error(err);
    }
  });
});

gulp.task('watch', function () {
  gulp.watch(config.frontendSource.code, [ 'jshint', 'install:client:code' ]);
  gulp.watch(config.frontendSource.scss, [ 'install:client:css' ]);
  gulp.watch(config.frontendSource.partials, [ 'install:client:partials' ]);
  gulp.watch(config.frontendSource.assets, [ 'install:client:assets' ]);
  gulp.watch(config.frontendSource.html, [ 'install:client:html' ]);
  gulp.watch(config.frontendSource.i18n, [ 'jsonlint' ]);
});

gulp.task('install:client', [ 'install:client:css', 'install:client:partials', 'install:client:code',
  'install:client:assets', 'install:client:html' ]);
gulp.task('install', [ 'install:client' ]);

gulp.task('default', [ 'install', 'watch', 'live', 'serve' ]);
<commit_msg>Temporarily remove livereload pipes<commit_after>var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var tinyLr = require('tiny-lr')();
var wiredep = require('wiredep').stream;

var config = require('./build.conf.js');
var lrPort = 35728;

gulp.task('install:client:css', function () {
  return gulp.src(config.frontendSource.scss)
    .pipe($.plumber())
    .pipe($.sourcemaps.init())
    .pipe($.sass())
    .pipe($.sourcemaps.write())
    .pipe($.concatCss('style.css'))
    .pipe(gulp.dest(config.frontendTarget.css));
});

gulp.task('install:client:partials', function () {
  return gulp.src(config.frontendSource.partials)
    .pipe($.plumber())
    .pipe($.ngHtml2js({
      moduleName: 'app.partials'
    }))
    .pipe($.concat('partials.js'))
    .pipe(gulp.dest(config.frontendTarget.js));
});

gulp.task('install:client:code', function () {
  return gulp.src(config.frontendSource.code)
    .pipe($.plumber())
    .pipe($.wrap('(function (angular) {\n<%= contents %>\n}(angular));'))
    .pipe($.sourcemaps.init())
    .pipe($.concat('scripts.js'))
    .pipe($.sourcemaps.write())
    .pipe(gulp.dest(config.frontendTarget.js));
});

gulp.task('install:client:assets', function () {
  return gulp.src(config.frontendSource.assets)
    .pipe($.plumber())
    .pipe(gulp.dest(config.frontendTarget.assets));
});

gulp.task('install:client:html', function () {
  return gulp.src(config.frontendSource.html)
    .pipe($.plumber())
    .pipe(wiredep({
      ignorePath: '.' + config.frontendTarget.html
    }))
    .pipe(gulp.dest(config.frontendTarget.html));
});

gulp.task('client:test', [ 'install' ], function () {
  return gulp.src(config.frontendSource.test)
    .pipe($.karma({
      configFile: 'karma.conf.js',
      action: 'run'
    }))
    .on('error', function (err) {
      throw err;
    });
});

gulp.task('client:test:watch', function () {
  return gulp.src(config.frontendSource.test)
    .pipe($.karma({
      configFile: 'karma.conf.js',
      action: 'watch'
    }));
});

gulp.task('jshint', function () {
  return gulp.src(config.backendSource.code.concat(config.frontendSource.code))
    .pipe($.plumber())
    .pipe($.jshint())
    .pipe($.jshint.reporter('jshint-stylish'))
});

gulp.task('jsonlint', function () {
  return gulp.src(config.frontendSource.i18n)
    .pipe($.plumber())
    .pipe($.jsonlint())
    .pipe($.jsonlint.reporter());
});

gulp.task('server:test', function () {
  return gulp.src(config.backendSource.test, { read: false })
    .pipe($.plumber())
    .pipe($.mocha({ reporter: 'spec' }));
});

gulp.task('serve', function () {
  $.nodemon({script: 'server/server.js', ignore: ['node_modules/**/*.js']})
    .on('restart', function () {
      $.livereload(tinyLr);
    });
});

gulp.task('live', function () {
  tinyLr.listen(lrPort, function (err) {
    if (err) {
      return console.error(err);
    }
  });
});

gulp.task('watch', function () {
  gulp.watch(config.frontendSource.code, [ 'jshint', 'install:client:code' ]);
  gulp.watch(config.frontendSource.scss, [ 'install:client:css' ]);
  gulp.watch(config.frontendSource.partials, [ 'install:client:partials' ]);
  gulp.watch(config.frontendSource.assets, [ 'install:client:assets' ]);
  gulp.watch(config.frontendSource.html, [ 'install:client:html' ]);
  gulp.watch(config.frontendSource.i18n, [ 'jsonlint' ]);
});

gulp.task('install:client', [ 'install:client:css', 'install:client:partials', 'install:client:code',
  'install:client:assets', 'install:client:html' ]);
gulp.task('install', [ 'install:client' ]);

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


<commit_before>'use strict';
var path = require('path');
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');

gulp.task('static', function () {
  return gulp.src('**/*.js')
    .pipe(excludeGitignore())
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

gulp.task('nsp', function (cb) {
  nsp({package: path.resolve('package.json')}, cb);
});

gulp.task('pre-test', function () {
  return gulp.src('generators/**/*.js')
    .pipe(excludeGitignore())
    .pipe(istanbul({
      includeUntested: true
    }))
    .pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function (cb) {
  var mochaErr;

  gulp.src('test/**/*.js')
    .pipe(plumber())
    .pipe(mocha({reporter: 'spec'}))
    .on('error', function (err) {
      mochaErr = err;
    })
    .pipe(istanbul.writeReports())
    .on('end', function () {
      cb(mochaErr);
    });
});

gulp.task('watch', function () {
  gulp.watch(['generators/**/*.js', 'test/**'], ['test']);
});

gulp.task('prepublish', ['nsp']);
gulp.task('default', ['static', 'test']);
<commit_msg>Removed gulpfile.js, new package.json<commit_after><|endoftext|>