<commit_before>'use strict';

var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var mocha = require('gulp-mocha');
var hf = require('gulp-headerfooter');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var beautify = require('gulp-beautify');

var DEST = 'dist/';

var paths = ['gulpfile.js', 'src/dot-object.js', 'test/**/*.js'];

gulp.task('jshint', function() {
  gulp.src(paths)
    .pipe(jshint())
    .pipe(jscs())
    .pipe(jshint.reporter('default'));
});

gulp.task('mocha', function() {
  gulp.src(['test/**/*.js'])
    .pipe(mocha())
     .on('error', gutil.log);
});

gulp.task('watch', function() {
  gulp.watch(paths, ['build-node', 'mocha']);
});

gulp.task('build-node', function() {
  gulp.src('src/dot-object.js')
    .pipe(hf.footer('\nmodule.exports = DotObject;\n'))
    .pipe(rename({basename: 'index'}))
    .pipe(gulp.dest('./'));
});

gulp.task('dist', function() {
  gulp.src('src/dot-object.js')
    .pipe(hf.header('src/header.tpl'))
    .pipe(hf.footer('src/footer.tpl'))
    .pipe(beautify({indentSize: 2}))
    .pipe(gulp.dest(DEST))
    .pipe(uglify())
    .pipe(rename({extname: '.min.js'}))
    .pipe(gulp.dest(DEST));
});

gulp.task('test', ['jshint', 'build-node', 'mocha']);

gulp.task('default', ['test']);
<commit_msg>change dist<commit_after>'use strict';

var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var mocha = require('gulp-mocha');
var hf = require('gulp-headerfooter');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var beautify = require('gulp-beautify');

var DEST = 'dist/';

var paths = ['gulpfile.js', 'src/dot-object.js', 'test/**/*.js'];

gulp.task('jshint', function() {
  gulp.src(paths)
    .pipe(jshint())
    .pipe(jscs())
    .pipe(jshint.reporter('default'));
});

gulp.task('mocha', function() {
  gulp.src(['test/**/*.js'])
    .pipe(mocha())
     .on('error', gutil.log);
});

gulp.task('watch', function() {
  gulp.watch(paths, ['build-node', 'mocha']);
});

gulp.task('build-node', function() {
  gulp.src('src/dot-object.js')
    .pipe(hf.footer('\nmodule.exports = DotObject;\n'))
    .pipe(rename({basename: 'index'}))
    .pipe(gulp.dest('./'));
});

gulp.task('build-bower', function() {
  gulp.src('src/dot-object.js')
    .pipe(hf.header('src/header.tpl'))
    .pipe(hf.footer('src/footer.tpl'))
    .pipe(beautify({indentSize: 2}))
    .pipe(gulp.dest(DEST))
    .pipe(uglify())
    .pipe(rename({extname: '.min.js'}))
    .pipe(gulp.dest(DEST));
});

gulp.task('dist', ['jshint', 'build-node', 'mocha', 'build-bower']);

gulp.task('test', ['jshint', 'build-node', 'mocha']);

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


<commit_before>var gulp = require('gulp'),
	less = require('gulp-less'),
	rename = require('gulp-rename'),
	csscomb = require('gulp-csscomb'),
	path = require('path');

var cssCombConfig = path.join(__dirname, 'node_modules',
	'zebracss-config', '.csscomb.json');

console.log(cssCombConfig);

gulp.task('less', function () {
	return gulp.src(path.join('.', 'index.less'))
		.pipe(less())
		.pipe(rename('zebra.css'))
		.pipe(gulp.dest(path.join('.', 'build')));
});

gulp.task('csscomb-lib', function() {
	return gulp.src(path.join('.', 'lib', '**', '*.less'))
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.', 'lib')));
});

gulp.task('csscomb-src', function() {
	return gulp.src(path.join('.', 'src', '**', '*.less'))
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.', 'src')));
});

gulp.task('csscomb-other', function() {
	return gulp.src(['index.less', 'libs.less'])
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.')));
});

gulp.task('csscomb', ['csscomb-lib', 'csscomb-src', 'csscomb-other']);

gulp.task('build', ['less']);
gulp.task('default', ['build']);<commit_msg>Update gulp file<commit_after>var gulp = require('gulp'),
	less = require('gulp-less'),
	rename = require('gulp-rename'),
	csscomb = require('gulp-csscomb'),
	path = require('path');

var cssCombConfig = path.join(__dirname, '.csscomb.json');

console.log(cssCombConfig);

gulp.task('less', function () {
	return gulp.src(path.join('.', 'index.less'))
		.pipe(less())
		.pipe(rename('zebra.css'))
		.pipe(gulp.dest(path.join('.', 'build')));
});

gulp.task('csscomb-lib', function() {
	return gulp.src(path.join('.', 'lib', '**', '*.less'))
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.', 'lib')));
});

gulp.task('csscomb-src', function() {
	return gulp.src(path.join('.', 'src', '**', '*.less'))
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.', 'src')));
});

gulp.task('csscomb-other', function() {
	return gulp.src(['index.less', 'libs.less'])
		.pipe(csscomb({
			configPath: cssCombConfig
		}))
		.pipe(gulp.dest(path.join('.')));
});

gulp.task('csscomb', ['csscomb-lib', 'csscomb-src', 'csscomb-other']);

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


<commit_before>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

'use strict';

const del = require('del');
const flatten = require('gulp-flatten');
const gulp = require('gulp');
const gulpBabel = require('gulp-babel');
const mergeStream = require('merge-stream');
const rename = require('gulp-rename');
const runSequence = require('run-sequence');

const fbjsConfigurePreset = require('babel-preset-fbjs/configure');
const gulpModuleMap = require('fbjs-scripts/gulp/module-map');
const gulpStripProvidesModule = require('fbjs-scripts/gulp/strip-provides-module');
const gulpCheckDependencies = require('fbjs-scripts/gulp/check-dependencies');

const paths = {
  lib: {
    src: [
      'src/**/*.js',
      '!src/**/__tests__/**/*.js',
      '!src/**/__mocks__/**/*.js',
    ],
    dest: 'lib',
    presetOptions: {
      stripDEV: true,
      rewriteModules: {
        map: require('fbjs-scripts/third-party-module-map'),
      },
    },
  },
  mocks: {
    src: [
      'src/**/__mocks__/**/*.js',
    ],
    dest: 'lib/__mocks__',
    presetOptions: {
      stripDEV: true,
      rewriteModules: {
        map: require('fbjs-scripts/third-party-module-map'),
        prefix: '../',
      },
    },
  },
};

const rewriteOptions = {
  moduleMapFile: './module-map.json',
  prefix: 'fbjs/lib/',
};

gulp.task('clean', function() {
  return del([paths.lib.dest, paths.mocks.dest]);
});

gulp.task('lib', function() {
  const libTask = gulp
    .src(paths.lib.src)
    .pipe(gulpModuleMap(rewriteOptions))
    .pipe(gulpStripProvidesModule())
    .pipe(gulpBabel(fbjsConfigurePreset(paths.lib.presetOptions)))
    .pipe(flatten())
    .pipe(gulp.dest(paths.lib.dest));

  const mockTask = gulp
    .src(paths.mocks.src)
    .pipe(gulpBabel(fbjsConfigurePreset(paths.mocks.presetOptions)))
    .pipe(flatten())
    .pipe(gulp.dest(paths.mocks.dest));

  return mergeStream(libTask, mockTask);
});

gulp.task('flow', function() {
  return gulp
    .src(paths.lib.src)
    .pipe(gulpModuleMap(rewriteOptions))
    .pipe(gulpBabel({
      presets: [
        fbjsConfigurePreset({
          target: 'flow',
          rewriteModules: {
            map: require('fbjs-scripts/third-party-module-map'),
          },
        }),
      ],
    }))
    .pipe(flatten())
    .pipe(rename({extname: '.js.flow'}))
    .pipe(gulp.dest(paths.lib.dest));
});

gulp.task('check-dependencies', function() {
  return gulp
    .src('package.json')
    .pipe(gulpCheckDependencies());
});

gulp.task('watch', function() {
  gulp.watch(paths.src, ['lib', 'flow']);
});

gulp.task('build', function(cb) {
  runSequence('check-dependencies', 'clean', ['lib', 'flow'], cb);
});

gulp.task('default', ['build']);
<commit_msg>Build fbjs flow files without autorequires<commit_after>/**
 * Copyright (c) 2013-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

'use strict';

const del = require('del');
const flatten = require('gulp-flatten');
const gulp = require('gulp');
const gulpBabel = require('gulp-babel');
const mergeStream = require('merge-stream');
const rename = require('gulp-rename');
const runSequence = require('run-sequence');

const fbjsConfigurePreset = require('babel-preset-fbjs/configure');
const gulpModuleMap = require('fbjs-scripts/gulp/module-map');
const gulpStripProvidesModule = require('fbjs-scripts/gulp/strip-provides-module');
const gulpCheckDependencies = require('fbjs-scripts/gulp/check-dependencies');

const paths = {
  lib: {
    src: [
      'src/**/*.js',
      '!src/**/__tests__/**/*.js',
      '!src/**/__mocks__/**/*.js',
    ],
    dest: 'lib',
    presetOptions: {
      stripDEV: true,
      rewriteModules: {
        map: require('fbjs-scripts/third-party-module-map'),
      },
    },
  },
  mocks: {
    src: [
      'src/**/__mocks__/**/*.js',
    ],
    dest: 'lib/__mocks__',
    presetOptions: {
      stripDEV: true,
      rewriteModules: {
        map: require('fbjs-scripts/third-party-module-map'),
        prefix: '../',
      },
    },
  },
};

const rewriteOptions = {
  moduleMapFile: './module-map.json',
  prefix: 'fbjs/lib/',
};

gulp.task('clean', function() {
  return del([paths.lib.dest, paths.mocks.dest]);
});

gulp.task('lib', function() {
  const libTask = gulp
    .src(paths.lib.src)
    .pipe(gulpModuleMap(rewriteOptions))
    .pipe(gulpStripProvidesModule())
    .pipe(gulpBabel(fbjsConfigurePreset(paths.lib.presetOptions)))
    .pipe(flatten())
    .pipe(gulp.dest(paths.lib.dest));

  const mockTask = gulp
    .src(paths.mocks.src)
    .pipe(gulpBabel(fbjsConfigurePreset(paths.mocks.presetOptions)))
    .pipe(flatten())
    .pipe(gulp.dest(paths.mocks.dest));

  return mergeStream(libTask, mockTask);
});

gulp.task('flow', function() {
  return gulp
    .src(paths.lib.src)
    .pipe(gulpModuleMap(rewriteOptions))
    .pipe(gulpBabel({
      presets: [
        fbjsConfigurePreset({
          autoImport: false,
          target: 'flow',
          rewriteModules: {
            map: require('fbjs-scripts/third-party-module-map'),
          },
        }),
      ],
    }))
    .pipe(flatten())
    .pipe(rename({extname: '.js.flow'}))
    .pipe(gulp.dest(paths.lib.dest));
});

gulp.task('check-dependencies', function() {
  return gulp
    .src('package.json')
    .pipe(gulpCheckDependencies());
});

gulp.task('watch', function() {
  gulp.watch(paths.src, ['lib', 'flow']);
});

gulp.task('build', function(cb) {
  runSequence('check-dependencies', 'clean', ['lib', 'flow'], cb);
});

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


<commit_before>'use strict';

var gulp = require('gulp'),
    concat = require('gulp-concat'),
    uglifycss = require('gulp-uglifycss'),
    rename = require('gulp-rename'),
    del = require('del'),
    flatten = require('gulp-flatten');

gulp.task('build-css', function() {
	gulp.src([
        'src/app/components/common/common.css',
		    'src/app/components/**/*.css'
    ])
        .pipe(concat('primeng.css'))
        .pipe(gulp.dest('dist/resources'));
});

gulp.task('build-css-prod', function() {
    gulp.src([
        'src/app/components/common/common.css',
        'src/app/components/badge/badge.css',
        'src/app/components/button/button.css',
        'src/app/components/checkbox/checkbox.css',
        'src/app/components/colorpicker/colorpicker-images.css',
        'src/app/components/inputtext/inputtext.css',
        'src/app/components/inputtextarea/inputtextarea.css',
        'src/app/components/password/password.css',
        'src/app/components/radiobutton/radiobutton.css',
        'src/app/components/tooltip/tooltip.css'
    ])
    .pipe(concat('primeng.css'))
    .pipe(gulp.dest('dist/resources'))
    .pipe(uglifycss({"uglyComments": true}))
    .pipe(rename('primeng.min.css'))
    .pipe(gulp.dest('dist/resources'));
});

gulp.task('copy-component-css', function () {
    gulp.src([
        'src/app/components/**/*.css',
        'src/app/components/**/images/*.png',
        'src/app/components/**/images/*.gif'
    ])
    .pipe(gulp.dest('dist/resources/components'));
});

gulp.task('images', function() {
    return gulp.src(['src/app/components/**/images/*.png', 'src/app/components/**/images/*.gif'])
        .pipe(flatten())
        .pipe(gulp.dest('dist/resources/images'));
});

gulp.task('themes', function() {
    return gulp.src(['src/assets/components/themes/**/*'])
        .pipe(gulp.dest('dist/resources/themes'));
});

//Cleaning previous gulp tasks from project
gulp.task('clean', function() {
	del(['dist/resources']);
});

//Copy readme
gulp.task('readme', function() {
    gulp.src(['README.md'])
    .pipe(gulp.dest('dist'));
});

//Building project with run sequence
gulp.task('build-assets', ['clean','copy-component-css', 'build-css-prod', 'images', 'themes', 'readme']);

        <commit_msg>Fixed #9111 - Ripple effect is not working<commit_after>'use strict';

var gulp = require('gulp'),
    concat = require('gulp-concat'),
    uglifycss = require('gulp-uglifycss'),
    rename = require('gulp-rename'),
    del = require('del'),
    flatten = require('gulp-flatten');

gulp.task('build-css', function() {
	gulp.src([
        'src/app/components/common/common.css',
		    'src/app/components/**/*.css'
    ])
        .pipe(concat('primeng.css'))
        .pipe(gulp.dest('dist/resources'));
});

gulp.task('build-css-prod', function() {
    gulp.src([
        'src/app/components/common/common.css',
        'src/app/components/badge/badge.css',
        'src/app/components/button/button.css',
        'src/app/components/checkbox/checkbox.css',
        'src/app/components/colorpicker/colorpicker-images.css',
        'src/app/components/inputtext/inputtext.css',
        'src/app/components/inputtextarea/inputtextarea.css',
        'src/app/components/password/password.css',
        'src/app/components/radiobutton/radiobutton.css',
        'src/app/components/ripple/ripple.css',
        'src/app/components/tooltip/tooltip.css'
    ])
    .pipe(concat('primeng.css'))
    .pipe(gulp.dest('dist/resources'))
    .pipe(uglifycss({"uglyComments": true}))
    .pipe(rename('primeng.min.css'))
    .pipe(gulp.dest('dist/resources'));
});

gulp.task('copy-component-css', function () {
    gulp.src([
        'src/app/components/**/*.css',
        'src/app/components/**/images/*.png',
        'src/app/components/**/images/*.gif'
    ])
    .pipe(gulp.dest('dist/resources/components'));
});

gulp.task('images', function() {
    return gulp.src(['src/app/components/**/images/*.png', 'src/app/components/**/images/*.gif'])
        .pipe(flatten())
        .pipe(gulp.dest('dist/resources/images'));
});

gulp.task('themes', function() {
    return gulp.src(['src/assets/components/themes/**/*'])
        .pipe(gulp.dest('dist/resources/themes'));
});

//Cleaning previous gulp tasks from project
gulp.task('clean', function() {
	del(['dist/resources']);
});

//Copy readme
gulp.task('readme', function() {
    gulp.src(['README.md'])
    .pipe(gulp.dest('dist'));
});

//Building project with run sequence
gulp.task('build-assets', ['clean','copy-component-css', 'build-css-prod', 'images', 'themes', 'readme']);

        <|endoftext|>


<commit_before>var gulp = require("gulp");
var del = require("del");
var tslint = require("tslint");
var mocha = require("gulp-mocha");
var istanbul = require("gulp-istanbul");
var ts = require("gulp-typescript");
var filter = require("gulp-filter");
var gulpTslint = require("gulp-tslint");
var replace = require("gulp-replace");
var p = require("./package.json");
var tsNameOf = require("ts-nameof");
var merge = require("merge2");

var unusedDefinitionsFilter = filter([
    "**", "!*/factories/CompilerFactory.d.ts", "!*/factories/index.d.ts", "!*/tests/**/*.d.ts", "!*/manipulation/**/*.d.ts"
]);

gulp.task("typescript", ["clean-scripts"], function() {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    var tsResult = gulp.src(["./src/**/*.ts"])
        .pipe(tsNameOf())
        .pipe(ts(tsProject));

    return merge([
        tsResult.dts.pipe(unusedDefinitionsFilter).pipe(gulp.dest('./dist')),
        tsResult.js.pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
            .pipe(replace(/(var __[a-z]+ = \(this && this.__[a-z]+\))/g, '$1/* istanbul ignore next */'))
            .pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
            // ignore empty constructors (for mixins and static classes)
            .pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
            .pipe(gulp.dest("./dist"))
    ]);
});

gulp.task("pre-test", ["typescript"], function () {
    return gulp.src(["dist/**/*.js", "!dist/tests/**/*.js", , "!dist/utils/TypeGuards.js"])
        .pipe(istanbul())
        .pipe(istanbul.hookRequire());
});

gulp.task("test", ["pre-test"], function() {
    return gulp.src("dist/tests/**/*.js")
        .pipe(mocha({ reporter: "progress", timeout: 10000 }))
        .pipe(istanbul.writeReports());
});

gulp.task("tslint", function() {
    //var program = tslint.Linter.createProgram("./tsconfig.json"); // doesn't seem to work well
    return gulp.src(["./src/**/*.ts", "!./src/typings/**/*.d.ts", "./code-generation/**/*.ts"])
        .pipe(gulpTslint({ formatter: "verbose", /*program*/ }))
        .pipe(gulpTslint.report());
});

gulp.task("watch", function() {
    gulp.watch("./src/**/*.ts", ["tslint", "typescript"]);
});

gulp.task("clean-scripts", ["clean-code-generation"], function(cb) {
    return del(["./dist/**/*"], cb);
});

gulp.task("clean-code-generation", function(cb) {
    return del(["./dist-cg/**/*"], cb);
});

gulp.task("code-generate", ["clean-code-generation"], function (cb) {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    var tsResult = gulp.src(["./{src,code-generation}/**/*.ts"])
        .pipe(tsNameOf())
        .pipe(ts(tsProject));

    return merge([
        tsResult.dts.pipe(unusedDefinitionsFilter).pipe(gulp.dest('./dist-cg')),
        tsResult.js.pipe(gulp.dest("./dist-cg"))
    ]);
});

gulp.task("default", ["tslint", "typescript"]);
<commit_msg>feat(core): support failing tests<commit_after>var gulp = require("gulp");
var del = require("del");
var tslint = require("tslint");
var mocha = require("gulp-mocha");
var istanbul = require("gulp-istanbul");
var ts = require("gulp-typescript");
var filter = require("gulp-filter");
var gulpTslint = require("gulp-tslint");
var replace = require("gulp-replace");
var p = require("./package.json");
var tsNameOf = require("ts-nameof");
var merge = require("merge2");

var unusedDefinitionsFilter = filter([
    "**", "!*/factories/CompilerFactory.d.ts", "!*/factories/index.d.ts", "!*/tests/**/*.d.ts", "!*/manipulation/**/*.d.ts"
]);

gulp.task("typescript", ["clean-scripts"], function() {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    var tsResult = gulp.src(["./src/**/*.ts"])
        .pipe(tsNameOf())
        .pipe(ts(tsProject));

    return merge([
        tsResult.dts.pipe(unusedDefinitionsFilter).pipe(gulp.dest('./dist')),
        tsResult.js.pipe(replace(/(}\)\()(.*\|\|.*;)/g, '$1/* istanbul ignore next */$2'))
            .pipe(replace(/(var __[a-z]+ = \(this && this.__[a-z]+\))/g, '$1/* istanbul ignore next */'))
            .pipe(replace(/(if \(!exports.hasOwnProperty\(p\)\))/g, '/* istanbul ignore else */ $1'))
            // ignore empty constructors (for mixins and static classes)
            .pipe(replace(/(function [A-Za-z]+\(\) {[\s\n\t]+})/g, '/* istanbul ignore next */ $1'))
            .pipe(gulp.dest("./dist"))
    ]);
});

gulp.task("pre-test", ["typescript"], function () {
    return gulp.src(["dist/**/*.js", "!dist/tests/**/*.js", , "!dist/utils/TypeGuards.js"])
        .pipe(istanbul())
        .pipe(istanbul.hookRequire());
});

gulp.task("test", ["pre-test"], function() {
    return gulp.src("dist/tests/**/*.js")
        .pipe(mocha({ reporter: "progress", timeout: 10000 }))
        .on('error', process.exit.bind(process, 1))
        .pipe(istanbul.writeReports());
});

gulp.task("tslint", function() {
    //var program = tslint.Linter.createProgram("./tsconfig.json"); // doesn't seem to work well
    return gulp.src(["./src/**/*.ts", "!./src/typings/**/*.d.ts", "./code-generation/**/*.ts"])
        .pipe(gulpTslint({ formatter: "verbose", /*program*/ }))
        .pipe(gulpTslint.report());
});

gulp.task("watch", function() {
    gulp.watch("./src/**/*.ts", ["tslint", "typescript"]);
});

gulp.task("clean-scripts", ["clean-code-generation"], function(cb) {
    return del(["./dist/**/*"], cb);
});

gulp.task("clean-code-generation", function(cb) {
    return del(["./dist-cg/**/*"], cb);
});

gulp.task("code-generate", ["clean-code-generation"], function (cb) {
    var tsProject = ts.createProject("tsconfig.json", {
        typescript: require("typescript")
    });

    var tsResult = gulp.src(["./{src,code-generation}/**/*.ts"])
        .pipe(tsNameOf())
        .pipe(ts(tsProject));

    return merge([
        tsResult.dts.pipe(unusedDefinitionsFilter).pipe(gulp.dest('./dist-cg')),
        tsResult.js.pipe(gulp.dest("./dist-cg"))
    ]);
});

gulp.task("default", ["tslint", "typescript"]);
<|endoftext|>


<commit_before>/*

REQUIRED STUFF
==============
*/

var changed     = require('gulp-changed');
var gulp        = require('gulp');
var sass        = require('gulp-sass');
var sourcemaps  = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
var notify      = require('gulp-notify');
var prefix      = require('gulp-autoprefixer');
var minifycss   = require('gulp-clean-css');
var uglify      = require('gulp-uglify');
var concat      = require('gulp-concat');
var util        = require('gulp-util');
var header      = require('gulp-header');
var pixrem      = require('gulp-pixrem');
var exec        = require('child_process').exec;

/*

FILE PATHS
==========
*/

var sassSrc = 'sass/**/*.{sass,scss}';
var sassFile = 'sass/base/layout.scss';
var cssDest = 'css';
var customjs = 'js/scripts.js';
var jsSrc = 'js/src/**/*.js';
var jsDest = 'js';

/*

ERROR HANDLING
==============
*/

var handleError = function(task) {
  return function(err) {

      notify.onError({
        message: task + ' failed, check the logs..'
      })(err);

    util.log(util.colors.bgRed(task + ' error:'), util.colors.red(err));
  };
};

/*

BROWSERSYNC
===========

Notes:
   - Add only file types you are working on - if watching the whole themeDir,
     task trigger will be out of sync because of the sourcemap-files etc.
   - Adding only part of the files will also make the task faster

*/

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

  var files = [
    '**/*.php',
    jsSrc
  ];

  browserSync.init(files, {
    proxy: "dudetest.dev",
    browser: "Google Chrome",
    notify: true
  });

});

/*

STYLES
======
*/

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

  gulp.src(sassFile)

    .pipe(sass({
      compass: false,
      bundleExec: true,
      sourcemap: false,
      style: 'compressed',
      debugInfo: true,
      lineNumbers: true,
      errLogToConsole: true,
      includePaths: [
        'bower_components/',
        'node_modules/',
        // require('node-bourbon').includePaths
      ],
    }))

    .on('error', handleError('styles'))
    .pipe(prefix('last 3 version', 'safari 5', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) // Adds browser prefixes (eg. -webkit, -moz, etc.)
    .pipe(pixrem())
    .pipe(minifycss({
      advanced: true,
      keepBreaks: false,
      keepSpecialComments: 0,
      mediaMerging: true,
      sourceMap: true
    }))
    .pipe(gulp.dest(cssDest))
    .pipe(browserSync.stream());

});

/*

SCRIPTS
=======
*/

var currentDate   = util.date(new Date(), 'dd-mm-yyyy HH:ss');
var pkg       = require('./package.json');
var banner      = '/*! <%= pkg.name %> <%= currentDate %> - <%= pkg.author %> */\n';

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

      gulp.src(
        [
          'node_modules/jquery/dist/jquery.js',
          'js/src/modernizr-custom.js',
          'js/src/skip-link-focus-fix.js',
          'js/src/responsive-nav.js',
          'js/src/scripts.js'
        ])
        .pipe(concat('all.js'))
        .pipe(uglify({preserveComments: false, compress: true, mangle: true}).on('error',function(e){console.log('\x07',e.message);return this.end();}))
        .pipe(header(banner, {pkg: pkg, currentDate: currentDate}))
        .pipe(gulp.dest(jsDest));
});

/*

WATCH
=====

*/

// Run the JS task followed by a reload
gulp.task('js-watch', ['js'], browserSync.reload);
gulp.task('watch', ['browsersync'], function() {

  gulp.watch(sassSrc, ['styles']);
  gulp.watch(jsSrc, ['js-watch']);

});
<commit_msg>configured gulp browsersync to open extrenal by default<commit_after>/*

REQUIRED STUFF
==============
*/

var changed     = require('gulp-changed');
var gulp        = require('gulp');
var sass        = require('gulp-sass');
var sourcemaps  = require('gulp-sourcemaps');
var browserSync = require('browser-sync').create();
var notify      = require('gulp-notify');
var prefix      = require('gulp-autoprefixer');
var minifycss   = require('gulp-clean-css');
var uglify      = require('gulp-uglify');
var concat      = require('gulp-concat');
var util        = require('gulp-util');
var header      = require('gulp-header');
var pixrem      = require('gulp-pixrem');
var exec        = require('child_process').exec;

/*

FILE PATHS
==========
*/

var sassSrc = 'sass/**/*.{sass,scss}';
var sassFile = 'sass/base/layout.scss';
var cssDest = 'css';
var customjs = 'js/scripts.js';
var jsSrc = 'js/src/**/*.js';
var jsDest = 'js';

/*

ERROR HANDLING
==============
*/

var handleError = function(task) {
  return function(err) {

      notify.onError({
        message: task + ' failed, check the logs..'
      })(err);

    util.log(util.colors.bgRed(task + ' error:'), util.colors.red(err));
  };
};

/*

BROWSERSYNC
===========

Notes:
   - Add only file types you are working on - if watching the whole themeDir,
     task trigger will be out of sync because of the sourcemap-files etc.
   - Adding only part of the files will also make the task faster

*/

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

  var files = [
    '**/*.php',
    jsSrc
  ];

  browserSync.init(files, {
    proxy: "dudetest.dev",
    browser: "Google Chrome",
    open: "external",
    notify: true
  });

});

/*

STYLES
======
*/

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

  gulp.src(sassFile)

    .pipe(sass({
      compass: false,
      bundleExec: true,
      sourcemap: false,
      style: 'compressed',
      debugInfo: true,
      lineNumbers: true,
      errLogToConsole: true,
      includePaths: [
        'bower_components/',
        'node_modules/',
        // require('node-bourbon').includePaths
      ],
    }))

    .on('error', handleError('styles'))
    .pipe(prefix('last 3 version', 'safari 5', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) // Adds browser prefixes (eg. -webkit, -moz, etc.)
    .pipe(pixrem())
    .pipe(minifycss({
      advanced: true,
      keepBreaks: false,
      keepSpecialComments: 0,
      mediaMerging: true,
      sourceMap: true
    }))
    .pipe(gulp.dest(cssDest))
    .pipe(browserSync.stream());

});

/*

SCRIPTS
=======
*/

var currentDate   = util.date(new Date(), 'dd-mm-yyyy HH:ss');
var pkg       = require('./package.json');
var banner      = '/*! <%= pkg.name %> <%= currentDate %> - <%= pkg.author %> */\n';

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

      gulp.src(
        [
          'node_modules/jquery/dist/jquery.js',
          'js/src/modernizr-custom.js',
          'js/src/skip-link-focus-fix.js',
          'js/src/responsive-nav.js',
          'js/src/scripts.js'
        ])
        .pipe(concat('all.js'))
        .pipe(uglify({preserveComments: false, compress: true, mangle: true}).on('error',function(e){console.log('\x07',e.message);return this.end();}))
        .pipe(header(banner, {pkg: pkg, currentDate: currentDate}))
        .pipe(gulp.dest(jsDest));
});

/*

WATCH
=====

*/

// Run the JS task followed by a reload
gulp.task('js-watch', ['js'], browserSync.reload);
gulp.task('watch', ['browsersync'], function() {

  gulp.watch(sassSrc, ['styles']);
  gulp.watch(jsSrc, ['js-watch']);

});
<|endoftext|>


<commit_before>var gulp = require('gulp');
var del = require('del');
var gutil = require("gulp-util");
var jsdoc2md = require("gulp-jsdoc-to-markdown");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var uglify = require('gulp-uglify');
var ngannotate = require('gulp-ng-annotate');
var stripDebug = require('gulp-strip-debug');
var iife = require('gulp-iife');
var fs = require("fs");
var webserver = require('gulp-webserver');
var bower = require('gulp-bower');
var replace = require('gulp-string-replace');
var runSequence = require('run-sequence');

var config = {

    srcPath: './app',
    destPath: './dist',

    bowerDir: './bower_components'
,
    publishPath: '/srv/www/app'
}

gulp.task('dev', function() {
  runSequence('bower', ['templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts'], ['webserver', 'watch']);
})

gulp.task('jenkins-build', function() {
  runSequence('bower', ['templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts'], 'publish');
})

gulp.task('webserver', function() {
  gulp.src(config.destPath)
    .pipe(webserver({
      livereload: true
    }));
});

gulp.task('publish', function() {
  gulp.src(config.destPath + '/**/*')
    .pipe(gulp.dest(config.publishPath))
})

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

    return bower()

        .pipe(gulp.dest(config.bowerDir))

});

gulp.task('bowercss', function() {
  gulp.src([
    config.bowerDir + '/bootstrap/dist/css/bootstrap.min.css',
    config.bowerDir + '/angular-xeditable/dist/css/xeditable.css'
  ])
  .pipe(replace('border-bottom: dashed 1px #428bca;', ''))
  .pipe(gulp.dest(config.destPath + '/css'))
});

gulp.task('bowerfonts', function() {
  gulp.src([
    config.bowerDir + '/bootstrap/dist/fonts/*',
  ])
  .pipe(gulp.dest(config.destPath + '/fonts'))
});

gulp.task('bowerjs', function() {
  gulp.src([
    config.bowerDir + '/angular/angular.min.js',
    config.bowerDir + '/angular/angular.js',
    config.bowerDir + '/angular/angular.min.js.map',
    config.bowerDir + '/angular-route/angular-route.min.js',
    config.bowerDir + '/angular-route/angular-route.js',
    config.bowerDir + '/angular-route/angular-route.min.js.map',
    config.bowerDir + '/jquery/dist/jquery.min.js',
    config.bowerDir + '/bootstrap/dist/js/bootstrap.min.js',
    config.bowerDir + '/firebase/firebase.js',
    config.bowerDir + '/angularfire/dist/angularfire.min.js',
    config.bowerDir + '/angular-local-storage/dist/angular-local-storage.min.js',
    config.bowerDir + '/angular-xeditable/dist/js/xeditable.min.js'
  ])
  .pipe(gulp.dest(config.destPath + '/js'))
});

gulp.task('js', function () {
    return gulp.src([
      config.srcPath + '/js/tdapp.js',
      config.srcPath + '/js/controller/*.js',
      config.srcPath + '/js/directive/*.js',
      config.srcPath + '/js/service/*.js',
      config.srcPath + '/js/tdapp_firebase.js'
    ])
        .pipe(concat('drtodolittle.js'))
        .pipe(ngannotate())
        .pipe(iife())
        .pipe(gulp.dest(config.destPath + '/js/'))
        .pipe(rename({ suffix: '.min' }))
        .pipe(stripDebug())
        .pipe(uglify())
        .pipe(gulp.dest(config.destPath + '/js/'))
});

gulp.task('css', function() {
    return gulp.src(config.srcPath + '/css/**/*')
        .pipe(gulp.dest(config.destPath + '/css'));
});

gulp.task('images', function() {
    return gulp.src(config.srcPath + '/images/**/*')
        .pipe(gulp.dest(config.destPath + '/images'));
});

gulp.task('templates', function() {
    return gulp.src(config.srcPath + '/templates/**/*')
        .pipe(gulp.dest(config.destPath + '/templates'));
});

gulp.task('html', function() {
    return gulp.src([config.srcPath + '/*.html', config.srcPath + '/favicon.ico'])
        .pipe(gulp.dest(config.destPath));
});

gulp.task('build', function() {
    gulp.start( 'templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts');
});

gulp.task('clean', function () {
    return del(config.destPath);
});

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

gulp.task('watch', function() {
  gulp.watch(config.srcPath + "**/*",['build'])
});
<commit_msg>Map files mitkopiert<commit_after>var gulp = require('gulp');
var del = require('del');
var gutil = require("gulp-util");
var jsdoc2md = require("gulp-jsdoc-to-markdown");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var uglify = require('gulp-uglify');
var ngannotate = require('gulp-ng-annotate');
var stripDebug = require('gulp-strip-debug');
var iife = require('gulp-iife');
var fs = require("fs");
var webserver = require('gulp-webserver');
var bower = require('gulp-bower');
var replace = require('gulp-string-replace');
var runSequence = require('run-sequence');

var config = {

    srcPath: './app',
    destPath: './dist',

    bowerDir: './bower_components'
,
    publishPath: '/srv/www/app'
}

gulp.task('dev', function() {
  runSequence('bower', ['templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts'], ['webserver', 'watch']);
})

gulp.task('jenkins-build', function() {
  runSequence('bower', ['templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts'], 'publish');
})

gulp.task('webserver', function() {
  gulp.src(config.destPath)
    .pipe(webserver({
      livereload: true
    }));
});

gulp.task('publish', function() {
  gulp.src(config.destPath + '/**/*')
    .pipe(gulp.dest(config.publishPath))
})

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

    return bower()

        .pipe(gulp.dest(config.bowerDir))

});

gulp.task('bowercss', function() {
  gulp.src([
    config.bowerDir + '/bootstrap/dist/css/bootstrap.min.css',
    config.bowerDir + '/bootstrap/dist/css/bootstrap.min.css.map',
    config.bowerDir + '/angular-xeditable/dist/css/xeditable.css'
  ])
  .pipe(replace('border-bottom: dashed 1px #428bca;', ''))
  .pipe(gulp.dest(config.destPath + '/css'))
});

gulp.task('bowerfonts', function() {
  gulp.src([
    config.bowerDir + '/bootstrap/dist/fonts/*',
  ])
  .pipe(gulp.dest(config.destPath + '/fonts'))
});

gulp.task('bowerjs', function() {
  gulp.src([
    config.bowerDir + '/angular/angular.min.js',
    config.bowerDir + '/angular/angular.js',
    config.bowerDir + '/angular/angular.min.js.map',
    config.bowerDir + '/angular-route/angular-route.min.js',
    config.bowerDir + '/angular-route/angular-route.js',
    config.bowerDir + '/angular-route/angular-route.min.js.map',
    config.bowerDir + '/jquery/dist/jquery.min.js',
    config.bowerDir + '/bootstrap/dist/js/bootstrap.min.js',
    config.bowerDir + '/firebase/firebase.js',
    config.bowerDir + '/angularfire/dist/angularfire.min.js',
    config.bowerDir + '/angular-local-storage/dist/angular-local-storage.min.js',
    config.bowerDir + '/angular-local-storage/dist/angular-local-storage.js',
    config.bowerDir + '/angular-local-storage/dist/angular-local-storage.min.js.map',
    config.bowerDir + '/angular-xeditable/dist/js/xeditable.min.js'
  ])
  .pipe(gulp.dest(config.destPath + '/js'))
});

gulp.task('js', function () {
    return gulp.src([
      config.srcPath + '/js/tdapp.js',
      config.srcPath + '/js/controller/*.js',
      config.srcPath + '/js/directive/*.js',
      config.srcPath + '/js/service/*.js',
      config.srcPath + '/js/tdapp_firebase.js'
    ])
        .pipe(concat('drtodolittle.js'))
        .pipe(ngannotate())
        .pipe(iife())
        .pipe(gulp.dest(config.destPath + '/js/'))
        .pipe(rename({ suffix: '.min' }))
        .pipe(stripDebug())
        .pipe(uglify())
        .pipe(gulp.dest(config.destPath + '/js/'))
});

gulp.task('css', function() {
    return gulp.src(config.srcPath + '/css/**/*')
        .pipe(gulp.dest(config.destPath + '/css'));
});

gulp.task('images', function() {
    return gulp.src(config.srcPath + '/images/**/*')
        .pipe(gulp.dest(config.destPath + '/images'));
});

gulp.task('templates', function() {
    return gulp.src(config.srcPath + '/templates/**/*')
        .pipe(gulp.dest(config.destPath + '/templates'));
});

gulp.task('html', function() {
    return gulp.src([config.srcPath + '/*.html', config.srcPath + '/favicon.ico'])
        .pipe(gulp.dest(config.destPath));
});

gulp.task('build', function() {
    gulp.start( 'templates', 'html', 'images', 'css', 'js', 'bowerjs', 'bowercss', 'bowerfonts');
});

gulp.task('clean', function () {
    return del(config.destPath);
});

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

gulp.task('watch', function() {
  gulp.watch(config.srcPath + "**/*",['build'])
});
<|endoftext|>


<commit_before>const spawn = require('child_process').spawn;
const gulp = require('gulp');
const changedInPlace = require('gulp-changed-in-place');
const sass = require('gulp-sass');
const notify = require('gulp-notify');
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const assets  = require('postcss-assets');
const sorting = require('postcss-sorting');
const prettier = require('gulp-prettier');
const autoprefixer = require('autoprefixer');
const flexbugs = require('postcss-flexbugs-fixes');
const PluginError = require('plugin-error');
const argv = require('minimist')(process.argv.slice(2));
const log = require('fancy-log');

const IS_PRODUCTION = !!argv.production;
const IS_DEVELOPMENT = !IS_PRODUCTION;
const SCSS_GLOB = './static/scss/**/*.scss';
const SCSS_ENTRY = './static/scss/main.scss';
const SCSS_PATH = './static/scss';
const CSS_PATH = './static/css';

const sortPlugin = sorting({
  order: [
    'custom-properties',
    'dollar-variables',
    'declarations',
    'rules',
    'at-rules',
  ],
  'properties-order': [
    'content',

    'position',
    'top',
    'right',
    'bottom',
    'left',
    'z-index',

    'display',
    'visibility',
    'opacity',
    'flex',
    'flex-grow',
    'flex-shrink',
    'flex-basis',
    'flex-direction',
    'flex-flow',
    'flex-wrap',
    'align-content',
    'align-items',
    'align-self',
    'justify-content',
    'order',
    'float',
    'clear',
    'box-sizing',
    'width',
    'min-width',
    'max-width',
    'height',
    'min-height',
    'max-height',
    'padding',
    'padding-top',
    'padding-right',
    'padding-bottom',
    'padding-left',
    'margin',
    'margin-top',
    'margin-right',
    'margin-bottom',
    'margin-left',
    'overflow',
    'overflow-x',
    'overflow-y',

    'font',
    'font-style',
    'font-weight',
    'font-size',
    'line-height',
    'font-family',
    'font-variant',
    'text-align',
    'text-decoration',
    'text-shadow',
    'text-transform',
    'white-space',
    'vertical-align',
    'list-style',
    'list-style-position',
    'list-style-type',

    'color',
    'border',
    'border-width',
    'border-style',
    'border-color',
    'border-top',
    'border-top-width',
    'border-top-style',
    'border-top-color',
    'border-right',
    'border-right-width',
    'border-right-style',
    'border-right-color',
    'border-bottom',
    'border-bottom-width',
    'border-bottom-style',
    'border-bottom-color',
    'border-left',
    'border-left-width',
    'border-left-style',
    'border-left-color',
    'border-radius',
    'border-top-left-radius',
    'border-top-right-radius',
    'border-bottom-right-radius',
    'border-bottom-left-radius',
    'background',
    'background-image',
    'background-position',
    'background-position-x',
    'background-position-y',
    'background-size',
    'background-repeat',
    'background-attachment',
    'background-origin',
    'background-clip',
    'background-color',
    'outline',
    'box-shadow',

    'filter',
    'transform',
    'transform-origin',

    'pointer-events',
    'cursor',

    'transition',
    'transition-property',
    'transition-duration',
    'transition-timing-function',
    'transition-delay',
    'animation',
  ],
});

const errorPlugin = () =>
  plumber(function(error) {
    if (IS_DEVELOPMENT) {
      notify.onError({
        title: 'Error on scss',
        message: error.messageFormatted,
        sound: false,
      })(error);
      this.emit('end');
    } else {
      throw error;
    }
  });

// Lints and fixes scss
function scss_fix() {
  if (IS_PRODUCTION) {
    return Promise.resolve();
  }
  return gulp
    .src(SCSS_GLOB)
    .pipe(changedInPlace())
    .pipe(errorPlugin())
    .pipe(postcss([sortPlugin], { syntax: require('postcss-scss') }))
    .pipe(
      prettier({
        parser: 'postcss',
      })
    )
    .pipe(gulp.dest(SCSS_PATH));
}

// Compiles to css and autoprefixes it
function scss_compile() {
  return gulp
    .src(SCSS_ENTRY)
    .pipe(errorPlugin())
    .pipe(
      sass({
        includePaths: ['node_modules/'],
        outputStyle: IS_PRODUCTION ? 'compressed' : 'nested',
      })
    )
    .pipe(
      postcss([
        assets({
          loadPaths: ['static/'],
        }),
        flexbugs,
        autoprefixer(),
      ])
    )
    .pipe(gulp.dest(CSS_PATH));
}

// Configures styles
function styles() {
  // Watch style folder for changes
  if (IS_DEVELOPMENT) {
    return gulp.watch(SCSS_GLOB, { awaitWriteFinish: true }, scss_compile);
  }
  return Promise.resolve();
}

// Runs Hugo
function hugo() {
  const flags = [];
  if (IS_DEVELOPMENT) {
    flags.push('server'); // watch and serve
    flags.push('--navigateToChanged'); // navigate to changed file
  }

  if (process.env['CONTEXT']
      && process.env['CONTEXT'] !== 'production'
      && process.env['DEPLOY_PRIME_URL']) {
    log('Setting baseURL: ' + process.env['DEPLOY_PRIME_URL']);
    flags.push('-b');
    flags.push(process.env['DEPLOY_PRIME_URL']);
  }
  const child = spawn('hugo', flags);

  child.stdout.setEncoding('utf8');
  child.stdout.on('data', data => {
    data
      .split('\n')
      .filter(line => {
        return line.length;
      })
      .forEach(line => {
        log(line.replace(/\d{4}-.+/, ''));
      });
  });

  child.stderr.setEncoding('utf8');
  child.stderr.on('data', data => {
    const error = new PluginError({
      plugin: 'Hugo',
      message: data,
    });
    if (IS_DEVELOPMENT) {
      notify.onError({
        title: 'Error on hugo',
        message: error.messageFormatted,
        sound: false,
      })(error);
    } else {
      throw error;
    }
  });
  return Promise.resolve();
}

log(
  'Running in',
  IS_PRODUCTION
    ? 'production'
    : 'development',
  'mode'
);

exports.default = gulp.series(
    gulp.parallel(gulp.series(scss_fix, scss_compile), hugo),
    styles);
<commit_msg>Compile SCSS before Hugo runs<commit_after>const spawn = require('child_process').spawn;
const gulp = require('gulp');
const changedInPlace = require('gulp-changed-in-place');
const sass = require('gulp-sass');
const notify = require('gulp-notify');
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const assets  = require('postcss-assets');
const sorting = require('postcss-sorting');
const prettier = require('gulp-prettier');
const autoprefixer = require('autoprefixer');
const flexbugs = require('postcss-flexbugs-fixes');
const PluginError = require('plugin-error');
const argv = require('minimist')(process.argv.slice(2));
const log = require('fancy-log');

const IS_PRODUCTION = !!argv.production;
const IS_DEVELOPMENT = !IS_PRODUCTION;
const SCSS_GLOB = './static/scss/**/*.scss';
const SCSS_ENTRY = './static/scss/main.scss';
const SCSS_PATH = './static/scss';
const CSS_PATH = './static/css';

const sortPlugin = sorting({
  order: [
    'custom-properties',
    'dollar-variables',
    'declarations',
    'rules',
    'at-rules',
  ],
  'properties-order': [
    'content',

    'position',
    'top',
    'right',
    'bottom',
    'left',
    'z-index',

    'display',
    'visibility',
    'opacity',
    'flex',
    'flex-grow',
    'flex-shrink',
    'flex-basis',
    'flex-direction',
    'flex-flow',
    'flex-wrap',
    'align-content',
    'align-items',
    'align-self',
    'justify-content',
    'order',
    'float',
    'clear',
    'box-sizing',
    'width',
    'min-width',
    'max-width',
    'height',
    'min-height',
    'max-height',
    'padding',
    'padding-top',
    'padding-right',
    'padding-bottom',
    'padding-left',
    'margin',
    'margin-top',
    'margin-right',
    'margin-bottom',
    'margin-left',
    'overflow',
    'overflow-x',
    'overflow-y',

    'font',
    'font-style',
    'font-weight',
    'font-size',
    'line-height',
    'font-family',
    'font-variant',
    'text-align',
    'text-decoration',
    'text-shadow',
    'text-transform',
    'white-space',
    'vertical-align',
    'list-style',
    'list-style-position',
    'list-style-type',

    'color',
    'border',
    'border-width',
    'border-style',
    'border-color',
    'border-top',
    'border-top-width',
    'border-top-style',
    'border-top-color',
    'border-right',
    'border-right-width',
    'border-right-style',
    'border-right-color',
    'border-bottom',
    'border-bottom-width',
    'border-bottom-style',
    'border-bottom-color',
    'border-left',
    'border-left-width',
    'border-left-style',
    'border-left-color',
    'border-radius',
    'border-top-left-radius',
    'border-top-right-radius',
    'border-bottom-right-radius',
    'border-bottom-left-radius',
    'background',
    'background-image',
    'background-position',
    'background-position-x',
    'background-position-y',
    'background-size',
    'background-repeat',
    'background-attachment',
    'background-origin',
    'background-clip',
    'background-color',
    'outline',
    'box-shadow',

    'filter',
    'transform',
    'transform-origin',

    'pointer-events',
    'cursor',

    'transition',
    'transition-property',
    'transition-duration',
    'transition-timing-function',
    'transition-delay',
    'animation',
  ],
});

const errorPlugin = () =>
  plumber(function(error) {
    if (IS_DEVELOPMENT) {
      notify.onError({
        title: 'Error on scss',
        message: error.messageFormatted,
        sound: false,
      })(error);
      this.emit('end');
    } else {
      throw error;
    }
  });

// Lints and fixes scss
function scss_fix() {
  if (IS_PRODUCTION) {
    return Promise.resolve();
  }
  return gulp
    .src(SCSS_GLOB)
    .pipe(changedInPlace())
    .pipe(errorPlugin())
    .pipe(postcss([sortPlugin], { syntax: require('postcss-scss') }))
    .pipe(
      prettier({
        parser: 'postcss',
      })
    )
    .pipe(gulp.dest(SCSS_PATH));
}

// Compiles to css and autoprefixes it
function scss_compile() {
  return gulp
    .src(SCSS_ENTRY)
    .pipe(errorPlugin())
    .pipe(
      sass({
        includePaths: ['node_modules/'],
        outputStyle: IS_PRODUCTION ? 'compressed' : 'nested',
      })
    )
    .pipe(
      postcss([
        assets({
          loadPaths: ['static/'],
        }),
        flexbugs,
        autoprefixer(),
      ])
    )
    .pipe(gulp.dest(CSS_PATH));
}

// Configures styles
function styles() {
  // Watch style folder for changes
  if (IS_DEVELOPMENT) {
    return gulp.watch(SCSS_GLOB, { awaitWriteFinish: true }, scss_compile);
  }
  return Promise.resolve();
}

// Runs Hugo
function hugo() {
  const flags = [];
  if (IS_DEVELOPMENT) {
    flags.push('server'); // watch and serve
    flags.push('--navigateToChanged'); // navigate to changed file
  }

  if (process.env['CONTEXT']
      && process.env['CONTEXT'] !== 'production'
      && process.env['DEPLOY_PRIME_URL']) {
    log('Setting baseURL: ' + process.env['DEPLOY_PRIME_URL']);
    flags.push('-b');
    flags.push(process.env['DEPLOY_PRIME_URL']);
  }
  const child = spawn('hugo', flags);

  child.stdout.setEncoding('utf8');
  child.stdout.on('data', data => {
    data
      .split('\n')
      .filter(line => {
        return line.length;
      })
      .forEach(line => {
        log(line.replace(/\d{4}-.+/, ''));
      });
  });

  child.stderr.setEncoding('utf8');
  child.stderr.on('data', data => {
    const error = new PluginError({
      plugin: 'Hugo',
      message: data,
    });
    if (IS_DEVELOPMENT) {
      notify.onError({
        title: 'Error on hugo',
        message: error.messageFormatted,
        sound: false,
      })(error);
    } else {
      throw error;
    }
  });
  return Promise.resolve();
}

log(
  'Running in',
  IS_PRODUCTION
    ? 'production'
    : 'development',
  'mode'
);

exports.default = gulp.series(scss_fix, scss_compile, hugo, styles);
<|endoftext|>


<commit_before>'use strict';

// Based on
// https://github.com/martinmicunda/employee-scheduling-ui/blob/master/gulpfile.js

//=============================================
//            PLUGIN REFERENCES
//=============================================
var gulp          = require('gulp');
var plugins       = require('gulp-load-plugins')();
var del           = require('del');
var path          = require('path');
var browserSync   = require('browser-sync');
var runSequence   = require('run-sequence');
var karma         = require('karma').server;
var moment        = require('moment');
var pkg           = require('./package.json');

//=============================================
//            DECLARE VARIABLES
//=============================================
var log                  = plugins.util.log;
var argv                 = plugins.util.env;
var COLORS               = plugins.util.colors;
var WATCH                = !!argv.watch ? argv.watch : false;
var BROWSERS             = !!argv.browsers ? argv.browsers : 'Chrome';
var REPORTERS            = !!argv.reporters ? argv.reporters : 'mocha';

//=============================================
//            DECLARE PATHS
//=============================================

var paths = {
    /**
     * The 'gulpfile' file is where our run tasks are hold.
     */
    gulpfile:   'gulpfile.js',
    /**
     * This is a collection of file patterns that refer to our app code (the
     * stuff in `app/`). These file paths are used in the configuration of
     * build tasks.
     *
     * - 'styles'       contains all project css styles
     * - 'images'       contains all project images
     * - 'fonts'        contains all project fonts
     * - 'scripts'      contains all project javascript except config-env.js and unit test files
     * - 'html'         contains main html files
     * - 'templates'    contains all project html templates
     */
    app: {
        basePath:       '/',
        fonts:          [
                          'fonts/**/*.{eot,svg,ttf,woff,woff2}',
                          'jspm_packages/**/*.{eot,svg,ttf,woff,woff2}'
                        ],
        styles: {
            scss:       'styles/**/*.scss',
            main:       'styles/main.scss',
            concat:     [
                        ],
            include:    [
                          'styles/',
                          'jspm_packages/github/twbs/bootstrap-sass@3.3.5/assets/stylesheets/',
                          'jspm_packages/github/fortawesome/font-awesome@4.3.0/scss/'
                        ]
        },
        images:         'images/**/*.{png,gif,jpg,jpeg}',
        scripts:        [
                          'app/**/*.js',
                          '!app/**/*.test.js'
                        ],
        html:           'index.html',
        templates:      'app/**/*.html'
    },
    /**
     * This is a collection of file patterns that refer to our app unit and e2e tests code.
     *
     * 'config'       contains karma and protractor config files
     * 'testReports'  contains unit and e2e test reports
     * 'unit'         contains all project unit test code
     * 'e2e'          contains all project e2e test code
     */
    test: {
        basePath:       'test/',
        config: {
            karma:      'karma.conf.js',
        },
        mock:           'app/**/*.mock.js',
        unit:           'app/**/*.test.js',
    },
    /**
     * The 'tmp' folder is where our html templates are compiled to JavaScript during
     * the build process and then they are concatenating with all other js files and
     * copy to 'dist' folder.
     */
    tmp: {
        basePath:       'tmp/',
        styles:         'tmp/styles/',
        scripts:        'tmp/scripts/',
        fonts:          'tmp/fonts/'
    },
    /**
     * The 'build' folder is where our app resides once it's
     * completely built.
     *
     * - 'dist'         application distribution source code
     * - 'docs'         application documentation
     */
    build: {
        basePath:       'dist/',
        dist: {
            basePath:   'dist/',
            fonts:      'dist/fonts/',
            images:     'dist/images/',
            styles:     'dist/styles/',
            scripts:    'dist/scripts/'
        },
        docs:           'docs/'
    }
};

//=============================================
//            UTILS FUNCTIONS
//=============================================
function formatPercent(num, precision){
    return (num*100).toFixed(precision);
}

function bytediffFormatter(data) {
    var difference = (data.savings > 0) ? ' smaller.' : ' larger.';
    return COLORS.yellow(data.fileName + ' went from ' +
    (data.startSize / 1000).toFixed(2) + ' kB to ' + (data.endSize / 1000).toFixed(2) + ' kB' +
    ' and is ' + formatPercent(1-data.percent, 2) + '%' + difference);
}

//=============================================
//            DECLARE BANNER DETAILS
//=============================================

/**
 * The banner is the comment that is placed at the top of our compiled
 * source files. It is first processed as a Gulp template, where the `<%=`
 * pairs are evaluated based on this very configuration object.
 */
var banner = plugins.util.template(
    '/**\n' +
    ' * <%= pkg.description %>\n' +
    ' * @version v<%= pkg.version %> - <%= today %>\n' +
    ' * @author <%= pkg.author.name %> (<%= pkg.author.url %>)\n' +
    ' * @copyright <%= year %>(c) <%= pkg.author.name %>\n' +
    //' * @license <%= pkg.license.type %>, <%= pkg.license.url %>\n' +
    ' */\n', {file: '', pkg: pkg, today: moment(new Date()).format('D/MM/YYYY'), year: new Date().toISOString().substr(0, 4)});

//=============================================
//               SUB TASKS
//=============================================

/**
 * The 'clean' task delete 'build' and '.tmp' directories.
 */
gulp.task('clean', function (cb) {
    var files = [].concat(paths.build.basePath, paths.tmp.basePath);
    log('Cleaning: ' + COLORS.blue(files));

    return del(files, cb);
});

/**
 * The 'eslint' task defines the rules of our hinter as well as which files
 * we should check. It helps to detect errors and potential problems in our
 * JavaScript code.
 */
gulp.task('eslint', function () {
    return gulp.src(paths.app.scripts)
        .pipe(plugins.eslint())
        .pipe(plugins.eslint.format())
        .pipe(plugins.eslint.failOnError())
        ;
});

/**
 * The 'htmlhint' task defines the rules of our hinter as well as which files we
 * should check. It helps to detect errors and potential problems in our
 * HTML code.
 */
gulp.task('htmlhint', function () {
    return gulp.src([paths.app.html, paths.app.templates])
        .pipe(plugins.htmlhint('.htmlhintrc'))
        .pipe(plugins.htmlhint.reporter())
        .pipe(plugins.htmlhint.failReporter());
});

/**
 * Build and copy all styles
*/
gulp.task('styles', ['sass'], function() {
  return gulp.src(paths.app.styles.concat)
      .pipe(plugins.autoprefixer({
        browsers: ['last 2 versions']
      }))
      .on('error', log)
      .pipe(gulp.dest(paths.tmp.styles))
      .on('error', log);
});

/**
 * Compile SASS files into the main.css.
 */
gulp.task('sass', function() {
    return gulp.src(paths.app.styles.main)
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.sass({
            includePaths: paths.app.styles.include,
            errLogToConsole: true
        }))
        .pipe(plugins.sourcemaps.write({includeContent: false}))
        .pipe(plugins.sourcemaps.init({loadMaps: true})) // Load sourcemaps generated by sass
        .pipe(plugins.autoprefixer({
          browsers: ['last 2 versions']
        }))
        .on('error', log)
        .pipe(plugins.sourcemaps.write('.'))
        .pipe(gulp.dest(paths.tmp.styles))
        .on('error', log);
});

/**
 * The 'fonts' task copies fonts to `build/dist` directory.
 */
gulp.task('fonts', function () {
    return gulp.src(paths.app.fonts)
      .pipe(plugins.filter('**/*.{eot,svg,ttf,woff,woff2}'))
      .pipe(plugins.flatten())
      .pipe(gulp.dest(paths.tmp.fonts))
      .pipe(gulp.dest(paths.build.dist.fonts))
      .pipe(plugins.size({title: 'fonts'}));
});

/**
 * The 'images' task minifies and copies images to `build/dist` directory.
 */
gulp.task('images', function () {
    return gulp.src(paths.app.images)
        .pipe(plugins.imagemin({
            progressive: true,
            interlaced: true
        }))
        .pipe(gulp.dest(paths.build.dist.images))
        .pipe(plugins.size({title: 'images'}));
});

/**
 * Create JS production bundle.
 */
gulp.task('bundle', ['eslint'], plugins.shell.task([
    'jspm bundle-sfx app/app-bootstrap ' + paths.tmp.scripts + 'build.js'
  ])
);

/**
 * The 'compile' task compile all js, css and html files.
 *
 * 1. it compiles and minify html templates to js template cache
 * 2. css      - replace local path with CDN url, minify, add revision number, add banner header
 *    css_libs - minify, add revision number
 *    js       - annotates the sources before minifying, minify, add revision number, add banner header
 *    js_libs  - minify, add revision number
 *    html     - replace local path with CDN url, minify
 */
gulp.task('compile', ['htmlhint', 'styles', 'bundle'], function () {
        var projectHeader = plugins.header(banner);

        return gulp.src(paths.app.html)
            .pipe(plugins.inject(gulp.src(paths.tmp.scripts + 'build.js', {read: false}), {
                starttag: '<!-- inject:build:js -->',
                ignorePath: [paths.app.basePath]
            }))
            .pipe(plugins.usemin({
                css: [
                    plugins.bytediff.start(),
                    plugins.minifyCss({
                      keepSpecialComments: 0,
                      rebase: false
                    }),
                    plugins.bytediff.stop(bytediffFormatter),
                    plugins.rev(),
                    projectHeader
                ],
                js: [
                    plugins.bytediff.start(),
                    plugins.uglify(),
                    plugins.bytediff.stop(bytediffFormatter),
                    plugins.rev(),
                    projectHeader
                ],
                html: [
                    plugins.bytediff.start(),
                    plugins.minifyHtml({empty:true}),
                    plugins.bytediff.stop(bytediffFormatter)
                ]
            }))
            .pipe(gulp.dest(paths.build.dist.basePath))
            .pipe(plugins.size({title: 'compile', showFiles: true}));
    });

/**
 * The 'watch' task set up the checks to see if any of the files listed below
 * change, and then to execute the listed tasks when they do.
 */
gulp.task('watch', function () {
    // Watch images and fonts files
    gulp.watch([paths.app.images, paths.app.fonts], [browserSync.reload]);

    // Watch css files
    gulp.watch(paths.app.styles.scss, ['styles']);

    // Watch js files
    gulp.watch([paths.app.scripts, paths.gulpfile], ['eslint', browserSync.reload]);

    // Watch html files
    gulp.watch([paths.app.html, paths.app.templates], ['htmlhint', browserSync.reload]);
});

//---------------------------------------------
//            DEVELOPMENT TASKS
//---------------------------------------------

/**
 * The 'serve' task serve the dev environment.
 */
gulp.task('serve', ['styles', 'watch'], function() {
    return browserSync.init([
      paths.tmp.styles,
      paths.app.scripts,
      paths.app.html,
      paths.app.templates
    ], {
      notify: false,
      port: 8000,
      browser: [],
      tunnel: false,
      server: true
    });

});

/**
 * The 'default' task serve the dev environment.
 */
gulp.task('default', ['serve']);

//---------------------------------------------
//               TEST TASKS
//---------------------------------------------

/**
 * The 'test:unit' task to run karma unit tests
 */
gulp.task('test:unit', function (cb) {
    // run the karma test
    karma.start({
        configFile: path.join(__dirname, paths.test.config.karma),
        browsers: [BROWSERS],
        reporters: [REPORTERS],
        singleRun: !WATCH,
        autoWatch: WATCH
    }, function(code) {
        // make sure failed karma tests cause gulp to exit non-zero
        if(code === 1) {
            log(COLORS.red('Error: unit test failed '));
            return process.exit(1);
        }
        cb();
    });
});

//---------------------------------------------
//               BUILD TASKS
//---------------------------------------------

/**
 * The 'build' task gets app ready for deployment by processing files
 * and put them into directory ready for production.
 */
gulp.task('build', function (cb) {
    runSequence(
        ['clean'],
        ['compile', 'images', 'fonts'],
        cb
    );
});
<commit_msg>Include 'font' task before `gulp serve'<commit_after>'use strict';

// Based on
// https://github.com/martinmicunda/employee-scheduling-ui/blob/master/gulpfile.js

//=============================================
//            PLUGIN REFERENCES
//=============================================
var gulp          = require('gulp');
var plugins       = require('gulp-load-plugins')();
var del           = require('del');
var path          = require('path');
var browserSync   = require('browser-sync');
var runSequence   = require('run-sequence');
var karma         = require('karma').server;
var moment        = require('moment');
var pkg           = require('./package.json');

//=============================================
//            DECLARE VARIABLES
//=============================================
var log                  = plugins.util.log;
var argv                 = plugins.util.env;
var COLORS               = plugins.util.colors;
var WATCH                = !!argv.watch ? argv.watch : false;
var BROWSERS             = !!argv.browsers ? argv.browsers : 'Chrome';
var REPORTERS            = !!argv.reporters ? argv.reporters : 'mocha';

//=============================================
//            DECLARE PATHS
//=============================================

var paths = {
    /**
     * The 'gulpfile' file is where our run tasks are hold.
     */
    gulpfile:   'gulpfile.js',
    /**
     * This is a collection of file patterns that refer to our app code (the
     * stuff in `app/`). These file paths are used in the configuration of
     * build tasks.
     *
     * - 'styles'       contains all project css styles
     * - 'images'       contains all project images
     * - 'fonts'        contains all project fonts
     * - 'scripts'      contains all project javascript except config-env.js and unit test files
     * - 'html'         contains main html files
     * - 'templates'    contains all project html templates
     */
    app: {
        basePath:       '/',
        fonts:          [
                          'fonts/**/*.{eot,svg,ttf,woff,woff2}',
                          'jspm_packages/**/*.{eot,svg,ttf,woff,woff2}'
                        ],
        styles: {
            scss:       'styles/**/*.scss',
            main:       'styles/main.scss',
            concat:     [
                        ],
            include:    [
                          'styles/',
                          'jspm_packages/github/twbs/bootstrap-sass@3.3.5/assets/stylesheets/',
                          'jspm_packages/github/fortawesome/font-awesome@4.3.0/scss/'
                        ]
        },
        images:         'images/**/*.{png,gif,jpg,jpeg}',
        scripts:        [
                          'app/**/*.js',
                          '!app/**/*.test.js'
                        ],
        html:           'index.html',
        templates:      'app/**/*.html'
    },
    /**
     * This is a collection of file patterns that refer to our app unit and e2e tests code.
     *
     * 'config'       contains karma and protractor config files
     * 'testReports'  contains unit and e2e test reports
     * 'unit'         contains all project unit test code
     * 'e2e'          contains all project e2e test code
     */
    test: {
        basePath:       'test/',
        config: {
            karma:      'karma.conf.js',
        },
        mock:           'app/**/*.mock.js',
        unit:           'app/**/*.test.js',
    },
    /**
     * The 'tmp' folder is where our html templates are compiled to JavaScript during
     * the build process and then they are concatenating with all other js files and
     * copy to 'dist' folder.
     */
    tmp: {
        basePath:       'tmp/',
        styles:         'tmp/styles/',
        scripts:        'tmp/scripts/',
        fonts:          'tmp/fonts/'
    },
    /**
     * The 'build' folder is where our app resides once it's
     * completely built.
     *
     * - 'dist'         application distribution source code
     * - 'docs'         application documentation
     */
    build: {
        basePath:       'dist/',
        dist: {
            basePath:   'dist/',
            fonts:      'dist/fonts/',
            images:     'dist/images/',
            styles:     'dist/styles/',
            scripts:    'dist/scripts/'
        },
        docs:           'docs/'
    }
};

//=============================================
//            UTILS FUNCTIONS
//=============================================
function formatPercent(num, precision){
    return (num*100).toFixed(precision);
}

function bytediffFormatter(data) {
    var difference = (data.savings > 0) ? ' smaller.' : ' larger.';
    return COLORS.yellow(data.fileName + ' went from ' +
    (data.startSize / 1000).toFixed(2) + ' kB to ' + (data.endSize / 1000).toFixed(2) + ' kB' +
    ' and is ' + formatPercent(1-data.percent, 2) + '%' + difference);
}

//=============================================
//            DECLARE BANNER DETAILS
//=============================================

/**
 * The banner is the comment that is placed at the top of our compiled
 * source files. It is first processed as a Gulp template, where the `<%=`
 * pairs are evaluated based on this very configuration object.
 */
var banner = plugins.util.template(
    '/**\n' +
    ' * <%= pkg.description %>\n' +
    ' * @version v<%= pkg.version %> - <%= today %>\n' +
    ' * @author <%= pkg.author.name %> (<%= pkg.author.url %>)\n' +
    ' * @copyright <%= year %>(c) <%= pkg.author.name %>\n' +
    //' * @license <%= pkg.license.type %>, <%= pkg.license.url %>\n' +
    ' */\n', {file: '', pkg: pkg, today: moment(new Date()).format('D/MM/YYYY'), year: new Date().toISOString().substr(0, 4)});

//=============================================
//               SUB TASKS
//=============================================

/**
 * The 'clean' task delete 'build' and '.tmp' directories.
 */
gulp.task('clean', function (cb) {
    var files = [].concat(paths.build.basePath, paths.tmp.basePath);
    log('Cleaning: ' + COLORS.blue(files));

    return del(files, cb);
});

/**
 * The 'eslint' task defines the rules of our hinter as well as which files
 * we should check. It helps to detect errors and potential problems in our
 * JavaScript code.
 */
gulp.task('eslint', function () {
    return gulp.src(paths.app.scripts)
        .pipe(plugins.eslint())
        .pipe(plugins.eslint.format())
        .pipe(plugins.eslint.failOnError())
        ;
});

/**
 * The 'htmlhint' task defines the rules of our hinter as well as which files we
 * should check. It helps to detect errors and potential problems in our
 * HTML code.
 */
gulp.task('htmlhint', function () {
    return gulp.src([paths.app.html, paths.app.templates])
        .pipe(plugins.htmlhint('.htmlhintrc'))
        .pipe(plugins.htmlhint.reporter())
        .pipe(plugins.htmlhint.failReporter());
});

/**
 * Build and copy all styles
*/
gulp.task('styles', ['sass'], function() {
  return gulp.src(paths.app.styles.concat)
      .pipe(plugins.autoprefixer({
        browsers: ['last 2 versions']
      }))
      .on('error', log)
      .pipe(gulp.dest(paths.tmp.styles))
      .on('error', log);
});

/**
 * Compile SASS files into the main.css.
 */
gulp.task('sass', function() {
    return gulp.src(paths.app.styles.main)
        .pipe(plugins.sourcemaps.init())
        .pipe(plugins.sass({
            includePaths: paths.app.styles.include,
            errLogToConsole: true
        }))
        .pipe(plugins.sourcemaps.write({includeContent: false}))
        .pipe(plugins.sourcemaps.init({loadMaps: true})) // Load sourcemaps generated by sass
        .pipe(plugins.autoprefixer({
          browsers: ['last 2 versions']
        }))
        .on('error', log)
        .pipe(plugins.sourcemaps.write('.'))
        .pipe(gulp.dest(paths.tmp.styles))
        .on('error', log);
});

/**
 * The 'fonts' task copies fonts to `build/dist` directory.
 */
gulp.task('fonts', function () {
    return gulp.src(paths.app.fonts)
      .pipe(plugins.filter('**/*.{eot,svg,ttf,woff,woff2}'))
      .pipe(plugins.flatten())
      .pipe(gulp.dest(paths.tmp.fonts))
      .pipe(gulp.dest(paths.build.dist.fonts))
      .pipe(plugins.size({title: 'fonts'}));
});

/**
 * The 'images' task minifies and copies images to `build/dist` directory.
 */
gulp.task('images', function () {
    return gulp.src(paths.app.images)
        .pipe(plugins.imagemin({
            progressive: true,
            interlaced: true
        }))
        .pipe(gulp.dest(paths.build.dist.images))
        .pipe(plugins.size({title: 'images'}));
});

/**
 * Create JS production bundle.
 */
gulp.task('bundle', ['eslint'], plugins.shell.task([
    'jspm bundle-sfx app/app-bootstrap ' + paths.tmp.scripts + 'build.js'
  ])
);

/**
 * The 'compile' task compile all js, css and html files.
 *
 * 1. it compiles and minify html templates to js template cache
 * 2. css      - replace local path with CDN url, minify, add revision number, add banner header
 *    css_libs - minify, add revision number
 *    js       - annotates the sources before minifying, minify, add revision number, add banner header
 *    js_libs  - minify, add revision number
 *    html     - replace local path with CDN url, minify
 */
gulp.task('compile', ['htmlhint', 'styles', 'bundle'], function () {
        var projectHeader = plugins.header(banner);

        return gulp.src(paths.app.html)
            .pipe(plugins.inject(gulp.src(paths.tmp.scripts + 'build.js', {read: false}), {
                starttag: '<!-- inject:build:js -->',
                ignorePath: [paths.app.basePath]
            }))
            .pipe(plugins.usemin({
                css: [
                    plugins.bytediff.start(),
                    plugins.minifyCss({
                      keepSpecialComments: 0,
                      rebase: false
                    }),
                    plugins.bytediff.stop(bytediffFormatter),
                    plugins.rev(),
                    projectHeader
                ],
                js: [
                    plugins.bytediff.start(),
                    plugins.uglify(),
                    plugins.bytediff.stop(bytediffFormatter),
                    plugins.rev(),
                    projectHeader
                ],
                html: [
                    plugins.bytediff.start(),
                    plugins.minifyHtml({empty:true}),
                    plugins.bytediff.stop(bytediffFormatter)
                ]
            }))
            .pipe(gulp.dest(paths.build.dist.basePath))
            .pipe(plugins.size({title: 'compile', showFiles: true}));
    });

/**
 * The 'watch' task set up the checks to see if any of the files listed below
 * change, and then to execute the listed tasks when they do.
 */
gulp.task('watch', function () {
    // Watch images and fonts files
    gulp.watch([paths.app.images, paths.app.fonts], [browserSync.reload]);

    // Watch css files
    gulp.watch(paths.app.styles.scss, ['styles']);

    // Watch js files
    gulp.watch([paths.app.scripts, paths.gulpfile], ['eslint', browserSync.reload]);

    // Watch html files
    gulp.watch([paths.app.html, paths.app.templates], ['htmlhint', browserSync.reload]);
});

//---------------------------------------------
//            DEVELOPMENT TASKS
//---------------------------------------------

/**
 * The 'serve' task serve the dev environment.
 */
gulp.task('serve', ['styles', 'images', 'fonts', 'watch'], function() {
    return browserSync.init([
      paths.tmp.styles,
      paths.app.scripts,
      paths.app.html,
      paths.app.templates
    ], {
      notify: false,
      port: 8000,
      browser: [],
      tunnel: false,
      server: true
    });

});

/**
 * The 'default' task serve the dev environment.
 */
gulp.task('default', ['serve']);

//---------------------------------------------
//               TEST TASKS
//---------------------------------------------

/**
 * The 'test:unit' task to run karma unit tests
 */
gulp.task('test:unit', function (cb) {
    // run the karma test
    karma.start({
        configFile: path.join(__dirname, paths.test.config.karma),
        browsers: [BROWSERS],
        reporters: [REPORTERS],
        singleRun: !WATCH,
        autoWatch: WATCH
    }, function(code) {
        // make sure failed karma tests cause gulp to exit non-zero
        if(code === 1) {
            log(COLORS.red('Error: unit test failed '));
            return process.exit(1);
        }
        cb();
    });
});

//---------------------------------------------
//               BUILD TASKS
//---------------------------------------------

/**
 * The 'build' task gets app ready for deployment by processing files
 * and put them into directory ready for production.
 */
gulp.task('build', function (cb) {
    runSequence(
        ['clean'],
        ['compile', 'images', 'fonts'],
        cb
    );
});
<|endoftext|>


<commit_before>'use strict';
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var hbsfy = require('hbsfy');
var opt = {
    build: 'build',
    app: {
        src: './src/js/app.js',
        dest: 'app.js'
    },
    vendors: 'vendors.js',

    jsAssets: [
        'src/js/**/*.*',
    ],

    cssAssets: [
        'src/css/bootstrap.min.css',
				'src/css/bootstrap-theme.min.css'
    ],

    fontAssets: [
        'src/fonts/*'
    ]
};

gulp.task('assets', ['assets:css', 'assets:fonts']);

gulp.task("assets:css", function() {
    return gulp.src(opt.cssAssets)
        .pipe(gulp.dest(opt.build + '/css'));
});

gulp.task("assets:fonts", function() {
    return gulp.src(opt.fontAssets)
        .pipe(gulp.dest(opt.build + '/fonts'));
});

gulp.task('build:js', [
    'browserify:app',
    'browserify:vendors'
]);

gulp.task('browserify:app', ['browserify:vendors'], function() {
    var bundleStream = browserify(opt.app.src);

    bundleStream
        .external('pouchdb')
        .external('backbone')
        .external('jquery')
        .external('backbone-pouch')
				.transform('hbsfy')
        .bundle()
        .pipe(source(opt.app.dest))
        .pipe(gulp.dest(opt.build + '/js'));

    return bundleStream;

});

gulp.task('browserify:vendors', function() {
    var vendorStream = browserify();
    vendorStream
        .require('backbone')
        .require('backbone-pouch')
        .require('jquery')
        .require('pouchdb')
        .bundle()
        .pipe(source(opt.vendors))
        .pipe(gulp.dest(opt.build + '/js'));

    return vendorStream;
});

gulp.task('watch', function() {
    gulp.watch(opt.jsAssets, ['build:js']);
});

gulp.task('default', ['build:js', 'assets']);
<commit_msg>Beautify gulpfile<commit_after>'use strict';
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var hbsfy = require('hbsfy');
var opt = {
  build: 'build',
  app: {
    src: './src/js/app.js',
    dest: 'app.js'
  },
  vendors: 'vendors.js',

  jsAssets: [
    'src/js/**/*.*',
  ],

  cssAssets: [
    'src/css/bootstrap.min.css',
    'src/css/bootstrap-theme.min.css'
  ],

  fontAssets: [
    'src/fonts/*'
  ]
};

gulp.task('assets', ['assets:css', 'assets:fonts']);

gulp.task("assets:css", function() {
  return gulp.src(opt.cssAssets)
    .pipe(gulp.dest(opt.build + '/css'));
});

gulp.task("assets:fonts", function() {
  return gulp.src(opt.fontAssets)
    .pipe(gulp.dest(opt.build + '/fonts'));
});

gulp.task('build:js', [
  'browserify:app',
  'browserify:vendors'
]);

gulp.task('browserify:app', ['browserify:vendors'], function() {
  var bundleStream = browserify(opt.app.src);

  bundleStream
    .external('pouchdb')
    .external('backbone')
    .external('jquery')
    .external('backbone-pouch')
    .transform('hbsfy')
    .bundle()
    .pipe(source(opt.app.dest))
    .pipe(gulp.dest(opt.build + '/js'));

  return bundleStream;

});

gulp.task('browserify:vendors', function() {
  var vendorStream = browserify();
  vendorStream
    .require('backbone')
    .require('backbone-pouch')
    .require('jquery')
    .require('pouchdb')
    .bundle()
    .pipe(source(opt.vendors))
    .pipe(gulp.dest(opt.build + '/js'));

  return vendorStream;
});

gulp.task('watch', function() {
  gulp.watch(opt.jsAssets, ['build:js']);
});

gulp.task('default', ['build:js', 'assets']);
<|endoftext|>


<commit_before>// Note the new way of requesting CoffeeScript since 1.7.x
require('coffee-script/register');
// This bootstraps your Gulp's main file
require('./gulpfile.coffee');
<commit_msg>remove unneeded gulpfile.js<commit_after><|endoftext|>


<commit_before>var gulp = require('gulp'),
    // watch = require('gulp-watch'),
    uglify = require('gulp-uglify'),
    webpackConfig = require("./webpack.config.js"),
    sourcemaps = require('gulp-sourcemaps'),
    ts = require('gulp-typescript');

var tsProject = ts.createProject('tsconfig.json');

// gulp.task('webpack', function () {
//     return gulp.src('./src/app.ts')
//         .pipe(webpack(webpackConfig))
//         .pipe(gulp.dest('./dist'));
// });

gulp.task('ts', function () {
    // var tsResult = tsProject.src()
    var tsResult = gulp.src("src/gis/**/*.ts")
        .pipe(sourcemaps.init())
        .pipe(tsProject());
    return tsResult.js
        .pipe(uglify())
        .pipe(sourcemaps.write('../sourcemaps'))
        .pipe(gulp.dest('dist/gis'));
});

gulp.task('watch', function () {
    gulp.watch('./src/gis/**/*.ts', ['ts']);
})

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

// gulp.task('stream', function () {
//     // Endless stream mode
//     return watch('css/**/*.css', { ignoreInitial: false })
//         .pipe(gulp.dest('build'));
// });

// gulp.task('callback', function () {
//     // Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event
//     return watch('css/**/*.css', function () {
//         gulp.src('css/**/*.css')
//             .pipe(gulp.dest('build'));
//     });
// });<commit_msg>地图编译提示<commit_after>var gulp = require('gulp'),
    // watch = require('gulp-watch'),
    uglify = require('gulp-uglify'),
    webpackConfig = require("./webpack.config.js"),
    sourcemaps = require('gulp-sourcemaps'),
    ts = require('gulp-typescript');

var tsProject = ts.createProject('tsconfig.json');

// gulp.task('webpack', function () {
//     return gulp.src('./src/app.ts')
//         .pipe(webpack(webpackConfig))
//         .pipe(gulp.dest('./dist'));
// });

gulp.task('ts', function () {
    // var tsResult = tsProject.src()
    var tsResult = gulp.src("src/gis/**/*.ts")
        .pipe(sourcemaps.init())
        .pipe(tsProject());
    return tsResult.js
        .pipe(uglify())
        .pipe(sourcemaps.write('../sourcemaps'))
        .pipe(gulp.dest('dist/gis'))
        .on('finish',()=>{console.log('地图模块编译完成')});
});

gulp.task('watch', function () {
    gulp.watch('./src/gis/**/*.ts', ['ts']);
})

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

// gulp.task('stream', function () {
//     // Endless stream mode
//     return watch('css/**/*.css', { ignoreInitial: false })
//         .pipe(gulp.dest('build'));
// });

// gulp.task('callback', function () {
//     // Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event
//     return watch('css/**/*.css', function () {
//         gulp.src('css/**/*.css')
//             .pipe(gulp.dest('build'));
//     });
// });<|endoftext|>


<commit_before>const gulp = require('gulp');
const sass = require('gulp-sass');
const less = require('gulp-less');
const sourcemaps = require('gulp-sourcemaps');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
const cssmin = require('gulp-cssmin');
const rename = require('gulp-rename');
const autoprefixer = require('gulp-autoprefixer');
const spritesmith = require('gulp.spritesmith-multi')
const merge = require('merge-stream')
const imagemin = require('gulp-imagemin')
const runSequence = require('run-sequence')
const del = require('del')
const watch = require('gulp-watch')
const concatCss = require('gulp-concat-css')
const browserSync = require('browser-sync').create();

const bases = {
    src: 'public/src/',
    dest: 'public/dist/'
};

const paths = {
    js: bases.src + 'js/**/*.js',
    scss: bases.src + 'css/scss/**/*.scss',
    less: bases.src + 'css/less/**/*.less',
    html: bases.src + '**/*.html',
    images: bases.src + 'img/**/*.*',
    sprites: bases.src + 'img/sprites/**/*.*'
};

gulp.task('html', function () {
    return gulp.src(paths.html)
        .pipe(gulp.dest(bases.dest))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('js-vendors', ['clean-js-folders'], function () {
    return gulp.src(bases.src + 'js/vendors/**/*.*')
        .pipe(gulp.dest(bases.dest + 'js/vendors'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('minify-js', ['js-vendors'], function () {
    return gulp.src([paths.js, '!public/src/js/vendors/**/*.*'])
        .pipe(concat('project-name.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest(bases.dest + 'js'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('sass', function () {
    return gulp.src(paths.scss)
        .pipe(sourcemaps.init())
        .pipe(sass({
            outputStyle: 'expanded'
        }).on('error', sass.logError))
        .pipe(sourcemaps.write())
        .pipe(autoprefixer({
            browsers: ['last 2 version', 'safari 5', 'ie 7', 'ie 8', 'ie 9', 'ios 6', 'android 4'],
            cascade: false
        }))
        .pipe(gulp.dest(bases.dest + 'css'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('minify-css', function () {
    gulp.src([bases.dest + 'css/**/*.css', '!public/dist/css/**/*.min.css'])
        .pipe(cssmin())
        .pipe(rename({
            suffix: '.min'
        }))
        .pipe(gulp.dest(bases.dest + 'css'));
});

gulp.task('images', function () {
    return gulp.src(paths.images)
        .pipe(imagemin())
        .pipe(gulp.dest(bases.dest + 'img'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('sprites', function () {
    var opts = {
        spritesmith: function (options, sprite, icons) {
            options.imgPath = `../img/sprites/${options.imgName}`;
            options.cssName = `${sprite}-sprites.css`;
            options.cssTemplate = null;
            options.cssSpritesheetName = sprite;
            options.padding = 4;
            options.cssVarMap = function (sp) {
                sp.name = `${sprite}-${sp.name}`;
            };
            return options;
        }
    };
    var spriteData = gulp.src('./public/src/img/sprites/**/*.png').pipe(spritesmith(opts)).on('error', function (err) {
        console.log(err)
    });

    var imgStream = spriteData.img.pipe(gulp.dest('./public/dist/img/sprites'));
    var cssStream = spriteData.css.pipe(gulp.dest('./public/dist/css/sprites'));

    return merge(imgStream, cssStream);
});

gulp.task('sprites-css-concat', function () {
    return gulp.src(bases.dest + 'css/sprites/**/*.css')
        .pipe(concatCss("sprites.css"))
        .pipe(gulp.dest(bases.dest + 'css/sprites'));
});

gulp.task('clean-dist-folders', function () {
    return del(bases.dest + '*.*');
});

gulp.task('clean-img-folders', function () {
    return del(bases.dest + 'img');
});

gulp.task('clean-css-folders', function () {
    return del(bases.dest + 'css');
});

gulp.task('clean-js-folders', function () {
    return del(bases.dest + 'js');
});

gulp.task('generate-sass', function () {
    runSequence('clean-css-folders', 'sprites', 'sass', 'sprites-css-concat', 'minify-css');
});

gulp.task('generate-images-sprites', function () {
    runSequence('clean-css-folders', 'clean-img-folders', 'images', 'sprites', 'sass', 'sprites-css-concat', 'minify-css');
});

gulp.task('watch', function () {
    gulp.watch(paths.html, ['html']);
    gulp.watch(paths.js, ['minify-js']);
    watch([paths.scss], function () {
        gulp.start('generate-sass');
    });
    gulp.watch(paths.scss, ['sass']);
    watch([paths.images], function () {
        gulp.start('generate-images-sprites');
    });
});

gulp.task('init-dist-resources', function () {
    gulp.start('clean-dist-folders');
    gulp.start('minify-js');
    gulp.start('generate-images-sprites');
    gulp.start('html');
})

gulp.task('server', ['watch'], function () {
    browserSync.init({
        server: {
            baseDir: bases.dest
        }
    });
});

gulp.task('default', ['init-dist-resources', 'server']);<commit_msg>자바스크립트 구문 체크<commit_after>var gulp = require('gulp');
var sass = require('gulp-sass');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var spritesmith = require('gulp.spritesmith-multi');
var merge = require('merge-stream');
var imagemin = require('gulp-imagemin');
var runSequence = require('run-sequence');
var del = require('del');
var watch = require('gulp-watch');
var concatCss = require('gulp-concat-css');
var browserSync = require('browser-sync').create();

var bases = {
    src: 'public/src/',
    dest: 'public/dist/'
};

var paths = {
    js: bases.src + 'js/**/*.js',
    scss: bases.src + 'css/scss/**/*.scss',
    less: bases.src + 'css/less/**/*.less',
    html: bases.src + '**/*.html',
    images: bases.src + 'img/**/*.*',
    sprites: bases.src + 'img/sprites/**/*.*'
};

gulp.task('html', function () {
    return gulp.src(paths.html)
        .pipe(gulp.dest(bases.dest))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('js-vendors', ['clean-js-folders'], function () {
    return gulp.src(bases.src + 'js/vendors/**/*.*')
        .pipe(gulp.dest(bases.dest + 'js/vendors'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('minify-js', ['js-vendors'], function () {
    return gulp.src([paths.js, '!public/src/js/vendors/**/*.*'])
        .pipe(concat('project-name.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest(bases.dest + 'js'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('sass', function () {
    return gulp.src(paths.scss)
        .pipe(sourcemaps.init())
        .pipe(sass({
            outputStyle: 'expanded'
        }).on('error', sass.logError))
        .pipe(sourcemaps.write())
        .pipe(autoprefixer({
            browsers: ['last 2 version', 'safari 5', 'ie 7', 'ie 8', 'ie 9', 'ios 6', 'android 4'],
            cascade: false
        }))
        .pipe(gulp.dest(bases.dest + 'css'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('minify-css', function () {
    gulp.src([bases.dest + 'css/**/*.css', '!public/dist/css/**/*.min.css'])
        .pipe(cssmin())
        .pipe(rename({
            suffix: '.min'
        }))
        .pipe(gulp.dest(bases.dest + 'css'));
});

gulp.task('images', function () {
    return gulp.src(paths.images)
        .pipe(imagemin())
        .pipe(gulp.dest(bases.dest + 'img'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

gulp.task('sprites', function () {
    var opts = {
        spritesmith: function (options, sprite, icons) {
            options.imgPath = `../img/sprites/${options.imgName}`;
            options.cssName = `${sprite}-sprites.css`;
            options.cssTemplate = null;
            options.cssSpritesheetName = sprite;
            options.padding = 4;
            options.cssVarMap = function (sp) {
                sp.name = `${sprite}-${sp.name}`;
            };
            return options;
        }
    };
    var spriteData = gulp.src('./public/src/img/sprites/**/*.png').pipe(spritesmith(opts)).on('error', function (err) {
        console.log(err)
    });

    var imgStream = spriteData.img.pipe(gulp.dest('./public/dist/img/sprites'));
    var cssStream = spriteData.css.pipe(gulp.dest('./public/dist/css/sprites'));

    return merge(imgStream, cssStream);
});

gulp.task('sprites-css-concat', function () {
    return gulp.src(bases.dest + 'css/sprites/**/*.css')
        .pipe(concatCss("sprites.css"))
        .pipe(gulp.dest(bases.dest + 'css/sprites'));
});

gulp.task('clean-dist-folders', function () {
    return del(bases.dest + '*.*');
});

gulp.task('clean-img-folders', function () {
    return del(bases.dest + 'img');
});

gulp.task('clean-css-folders', function () {
    return del(bases.dest + 'css');
});

gulp.task('clean-js-folders', function () {
    return del(bases.dest + 'js');
});

gulp.task('generate-sass', function () {
    runSequence('clean-css-folders', 'sprites', 'sass', 'sprites-css-concat', 'minify-css');
});

gulp.task('generate-images-sprites', function () {
    runSequence('clean-css-folders', 'clean-img-folders', 'images', 'sprites', 'sass', 'sprites-css-concat', 'minify-css');
});

gulp.task('watch', function () {
    gulp.watch(paths.html, ['html']);
    gulp.watch(paths.js, ['minify-js']);
    watch([paths.scss], function () {
        gulp.start('generate-sass');
    });
    gulp.watch(paths.scss, ['sass']);
    watch([paths.images], function () {
        gulp.start('generate-images-sprites');
    });
});

gulp.task('init-dist-resources', function () {
    gulp.start('clean-dist-folders');
    gulp.start('minify-js');
    gulp.start('generate-images-sprites');
    gulp.start('html');
});

gulp.task('server', ['watch'], function () {
    browserSync.init({
        server: {
            baseDir: bases.dest
        }
    });
});

gulp.task('default', ['init-dist-resources', 'server']);<|endoftext|>