https://github.com/jussi-kalliokoski/gulp-awspublish-router/blob/master/lib/utils/initFile.js
973920
function s3Init(file) {
  if (file.s3) {
    return;
  }

  file.s3 = {};
  file.s3.headers = {};
  file.s3.path = file.path.replace(file.base, "").replace(new RegExp("\\" + path.sep, "g"), "/");
}
779254
function () {
    var start = Date.now();
    bundler.bundle()
      .on('error', gutil.log)
      .pipe(source(options.name))
      .pipe(gulpif(options.uglify, streamify(uglify())))
      .pipe(gulp.dest(options.dest))
      .pipe(notify(function () {

        // Fix for requirejs
        var fs = require('fs');
        var file = fs.readFileSync(options.dest + '/' + options.name).toString();
        file = file.replace('define([],e)', 'define(["react"],e)');
        fs.writeFileSync(options.dest + '/' + options.name, file);

        console.log('Built in ' + (Date.now() - start) + 'ms');

      }));

  }
1189603
function lint() {
  var errorsFound = false;
  var stream = gulp.src(config.lintGlobs);

  if (isWatching) {
    stream = stream.pipe(watcher());
  }

  if (argv.fix) {
    options.fix = true;
  }

  return stream.pipe(eslint(options))
    .pipe(eslint.formatEach('stylish', function(msg) {
      errorsFound = true;
      util.log(util.colors.red(msg));
    }))
    .pipe(gulpIf(isFixed, gulp.dest('.')))
    .pipe(eslint.failAfterError())
    .on('end', function() {
      if (errorsFound && !options.fix) {
        util.log(util.colors.blue('Run `gulp lint --fix` to automatically ' +
            'fix some of these lint warnings/errors. This is a destructive ' +
            'operation (operates on the file system) so please make sure ' +
            'you commit before running.'));
      }
    });
}
303436
function _createFileTask(gulp, name, config, depTasks, index, startFun, endFun) {
    gulp.task(name, depTasks, function(){
        var s = config.files[index];
       return runFileTaskStream(gulp, s, config, startFun, endFun);
    });
}
930681
function(){
        var path = $options.path;

        $fs.exists("fis-conf.js", function(res){
            if(res == true){
                $fs.exists(path, function(res){
                    if(res == true){
                        console.log("[Error-1001] This path:"+path+" exists");
                    }else{
                        snippets.fn.appFolder(path);
                    }
                });
            }else{
                console.log("[Error-1002] In this folder that can't build widget or page folders");
            }
        });
    }
577445
function initTasks (gulp, config) {
	var pkg = readPackageJSON();
	var name = capitalize(camelCase(config.component.pkgName || pkg.name));

	config = defaults(config, { aliasify: pkg.aliasify });
	config.component = defaults(config.component, {
		pkgName: pkg.name,
		dependencies: pkg.deps,
		name: name,
		src: 'src',
		lib: 'lib',
		dist: 'dist',
		file: (config.component.name || name) + '.js'
	});

	if (config.example) {
		if (config.example === true) config.example = {};

		defaults(config.example, {
			src: 'example/src',
			dist: 'example/dist',
			files: ['index.html'],
			scripts: ['example.js'],
			less: ['example.less']
		});
	}

	require('./tasks/bump')(gulp, config);
	require('./tasks/dev')(gulp, config);
	require('./tasks/dist')(gulp, config);
	require('./tasks/release')(gulp, config);

	var buildTasks = ['build:dist'];
	var cleanTasks = ['clean:dist'];

	if (config.component.lib) {
		require('./tasks/lib')(gulp, config);
		buildTasks.push('build:lib');
		cleanTasks.push('clean:lib');
	}

	if (config.example) {
		require('./tasks/examples')(gulp, config);
		buildTasks.push('build:examples');
		cleanTasks.push('clean:examples');
	}

	gulp.task('build', buildTasks);
	gulp.task('clean', cleanTasks);
}
116687
function Devour(settings) {
	var devour = this,
		gulp = require('gulp'),
		glob = require('glob'),
		chalk = require('chalk'),
		submerge = require('submerge'),
		polymorphic = require('polymorphic'),
		Wanted = require('wanted'),
		chain = require('gulp-chain'),
		watcher = require('gulp-watch'),
		wanted = new Wanted(),
		definitions = {},
		run = process.argv.splice(2),
		config = submerge(settings, {
			debounce: 100,
			basePath: process.cwd(),
			gulpFiles: 'gulp',
			output: 'dist',
			verbose: !run.length
		}),
		active = [];

	/**
	 *  Initialize Devour
	 *  @name    init
	 *  @access  internal
	 *  @return  void
	 */
	function init() {
		Object.defineProperty(devour, 'gulp', {
			enumerable: true,
			value: gulp
		});

		preload();
	}

	/**
	 *  Load all available tasks and pipes
	 *  @name    preload
	 *  @access  internal
	 *  @return  void
	 */
	function preload() {
		var path = config.gulpFiles;

		if (/^[^\/]/.test(path)) {
			path = config.basePath + '/' + path;
		}

		glob.sync(path + '/*/*.js').map(function(file) {
			return file.replace(path, '').split('/').filter(function(split) {
				return !!split;
			});
		}).forEach(function(file) {
			register(
				file[0],
				file[file.length - 1].replace(/\.js$/, ''),
				require(path + '/' + file.join('/'))
			);
		});

		console.log(chalk.cyan('Devour initialized'));

		if (config.verbose) {
			['task', 'pipe'].forEach(function(what) {
				console.log(
					'  - available %ss: %s',
					what,
					what in definitions ? chalk.green(Object.keys(definitions[what]).join(', ')) : chalk.yellow('none')
				);
			});
			console.log('');
		}
	}

	/**
	 *  Register a task or pipe
	 *  @name    resgister
	 *  @access  internal
	 *  @param   string type [accepts any value, actual values: 'task' or 'pipe']
	 *  @param   string name
	 *  @param   function create
	 *  @return  void
	 */
	function register(type, name, create) {
		if (!(type in definitions)) {
			definitions[type] = {};
		}

		if (type === 'pipe') {
			create = chain(create, devour);
		}

		definitions[type][name] = create;
	}

	/**
	 *  Obtain a gulp plugin, initialized with given arguments
	 *  @name    plug
	 *  @access  internal
	 *  @param   string  name [automatically prefixed with 'gulp-']
	 *  @return  stream  initialized plugin
	 */
	function plug(name) {
		var part, scope;

		if (!('buffer' in plug.prototype)) {
			plug.prototype.buffer = {};
		}

		part  = name.split('.');
		scope = part.shift();

		if (!(scope in plug.prototype.buffer)) {
			plug.prototype.buffer[scope] = wanted.require('gulp-' + scope);
		}

		scope = plug.prototype.buffer[scope];

		part.forEach(function(p) {
			scope = scope[p];
		});

		//  this may be an a-typical gulp plugin (e.g. sourcemaps) which provides no stream, the implementer probably
		//  knows what to do with this
		if (typeof scope !== 'function') {
			return scope;
		}

		//  invoke the function in the scope with the arguments after the name
		//  this should create a stream
		return scope.apply(null, Array.prototype.slice.call(arguments, 1))
			//  always register an error listener for plugins
			.on('error', function(error) {
				console.error('Error from plugin %s: %s', chalk.red(name), error);
				this.emit('end');
			})
		;
	}

	/**
	 *  Start tasks provided from the command line
	 *  @name    startRequested
	 *  @access  internal
	 *  @return  bool  started
	 */
	function startRequested() {
		var start = [];

		if (run.length) {
			run.forEach(function(task) {
				var exists = task.replace(/:.*$/, '') in definitions.task;

				console.log(
					'Task %s %s',
					exists ? chalk.green(task) : chalk.red(task),
					exists ? 'running' : 'not found!'
				);

				if (exists) {
					start.push(task);
				}
			});

			if (start.length) {
				gulp.start.apply(gulp, start.concat([function(error) {
					if (error) {
						throw new Error(error);
					}

					console.log('Complete');
				}]));
			}
			else {
				console.log(chalk.red('No tasks are running, exiting!'));
				process.exit(1);
			}
		}

		return !!start.length;
	}

	/**
	 *  Create a plugin and initialize it
	 *  @name    plugin
	 *  @access  public
	 *  @param   mixed   arguments
	 *  @return  stream
	 */
	devour.plugin = plug;

	/**
	 *  Cleanup file basename and append .min to it
	 *  @name    min
	 *  @access  public
	 *  @param   object  file
	 *  @return  void
	 */
	devour.min = function(file) {
		file.basename = file.basename.replace(/\.(?:min|prep)/, '') + '.min';
	};

	/**
	 *  Require a module, trying to install it if not available
	 *  @name    require
	 *  @access  public
	 *  @param   string    module
	 *  @return  function  module
	 */
	devour.require = function(module) {
		return wanted.require(module);
	};

	/**
	 *  Create a source list and pipe it through the 'defaults' pipe
	 *  @name    source
	 *  @access  public
	 *  @param   mixed sources [one of: string, array]
	 *  @return  stream
	 */
	devour.source = function() {
		var source = gulp.src.apply(gulp, arguments);

		if ('defaults' in config) {
			config.defaults.forEach(function(name) {
				source = source.pipe(devour.plugin(name));
			});
		}

		return source;
	};

	/**
	 *  Invoke the predefined pipe and return its stream
	 *  @name    pipe
	 *  @access  public
	 *  @param   string  pipe
	 *  @return  stream
	 */
	devour.pipe = function() {
		var arg = Array.prototype.slice.call(arguments),
			name = arg.shift();

		if ('pipe' in definitions && name in definitions.pipe) {
			if (+config.verbose > 2) {
				console.log('  - Laying pipe: %s', chalk.yellow(name));
			}

			return definitions.pipe[name].apply(null, [null].concat(arg))
				//  always register an error listener for pipes
				.on('error', function(error) {
					console.error('Error in pipe %s: %s', chalk.red(name), error);
					this.emit('end');
				})
			;
		}

		throw new Error('Named pipe not found: ' + name);
	};

	/**
	 *  Obtain all settings, a single setting or a default value
	 *  @name    config
	 *  @access  public
	 *  @param   string  key [optional, default undefined - return the entire configuration]
	 *  @param   mixed   otherwise
	 *  @return  mixed
	 */
	devour.config = function(value, otherwise) {
		return arguments.length ? config[value] || otherwise : config;
	};

	/**
	 *  Write the contents of the current stream into the file in the stream
	 *  @name    write
	 *  @access  public
	 *  @param   string  relative [optional, default undefined - the configured 'output' path]
	 *  @param   object  options  [optional, default undefined - no options]
	 *  @return  stream
	 */
	devour.write = function(relative, options) {
		var path = config.output;

		if (/^\//.test(relative)) {
			path = relative;
		}
		else {
			path += '/' + (relative || '');
		}

		return gulp.dest(path, options || {read:true});
	};

	/**
	 *  Schedule a task
	 *  @name    task
	 *  @access  public
	 *  @param   string  name
	 *  @param   mixed   build [one of: string, array]
	 *  @param   mixed   watch [optional, default true - the value of build, one of string, array, bool provide (bool) false to disable]
	 *  @return  devour  [chainable]
	 */
	devour.task = polymorphic();
	devour.task.signature(
		'string name, array build, array watch',
		function(name, build, watch) {
			if (config.verbose) {
				console.log(
					'Task %s activated\n  - build files: %s\n  - watch files: %s',
					chalk.cyan(name),
					chalk.yellow(build.join(chalk.white(', '))),
					watch.length ? chalk.yellow(watch.join(chalk.white(', '))) : chalk.red('(none, not watching)')
				);
			}

			gulp.task(name, function() {
				var start = process.hrtime();

				if (+config.verbose > 1) {
					console.log('Running task: %s', chalk.yellow(name));
				}

				return definitions.task[name.replace(/:.*$/, '')](
						build.length ? devour.source(build) : null,
						devour,
						name)
					.on('end', function() {
						var delta = process.hrtime(start);
						if (+config.verbose > 1) {
							console.log(
								'Completed task: %s (%s)',
								chalk.yellow(name),
								chalk.green((delta[0] * 1e3 + delta[1] / 1e6).toFixed(2) + 'ms')
							);
						}
					})
				;
			});

			if (!run.length && watch.length) {
				active.push(name);
				watcher(watch, function() {
					gulp.start(name);
				});

				// gulp.watch(watch, {debounceDelay: config.debounce}, [name]);
			}

			return devour;
		}
	);

	devour.task.signature(
		'string name, string build, array watch',
		function(name, build, watch) {
			return devour.task(name, [build], watch);
		}
	);
	devour.task.signature(
		'string name, array build, string watch',
		function(name, build, watch) {
			return devour.task(name, build, [watch]);
		}
	);
	devour.task.signature(
		'string name, string build, string watch',
		function(name, build, watch) {
			return devour.task(name, [build], [watch]);
		}
	);
	devour.task.signature(
		'string name, array build, bool watch=true',
		function(name, build, watch) {
			return devour.task(name, build, watch ? build : []);
		}
	);
	devour.task.signature(
		'string name, string build, bool watch=true',
		function(name, build, watch) {
			return devour.task(name, [build], watch ? [build] : []);
		}
	);
	devour.task.signature(
		'string name',
		function(name) {
			return devour.task(name, [], []);
		}
	);

	/**
	 *  Create a default task for all scheduled tasks and let gulp do the heavy lifting
	 *  @name    start
	 *  @access  public
	 *  @param   function callback [optional, default undefined - no callback]
	 *  @return  void
	 */
	devour.start = function(callback) {
		if (startRequested()) {
			return;
		}

		if (!gulp.hasTask('default')) {
			if (config.verbose) {
				console.log(
					'\nNo %s task found, creating it with tasks: %s',
					chalk.cyan('default'),
					active.length ? chalk.cyan(active.join(chalk.white(', '))) : chalk.red('(none)')
				);
			}

			gulp.task('default', active, callback);

			console.log(
				'Created %s task: %s',
				chalk.cyan('default'),
				gulp.hasTask('default') ? chalk.green('OK') : chalk.red('failed')
			);
		}

		console.log(chalk.yellow('Starting gulp\n'));
		gulp.start('default');
	};

	init();
}
1276319
function initApiProxy() {
  if (build.verbose)
    console.log('Proxying paths...');
  lodash.forEach(build.proxyMap, function (proxyOpts, urlPath) {
    if (build.verbose)
      console.log('  - url: "' + urlPath + '"');
    app.use(urlPath, proxy(proxyOpts));
    // e.g. `app.use('/api', proxy({target: "http://localhost:4321/api", 
    // changeOrigin: true});`
  });
}
1135810
function define (HTMLFile, utils) {
  const { callable } = utils;
  const { debug, error, strong } = utils.cnsl;
  const { regexpEscape, uniqueMatch } = utils.string;

  return class HANDLEBARSFile extends HTMLFile {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Object} caches
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Object} globalAliases
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     */
    constructor (id, filepath, options) {
      super(id, filepath, options);

      this.workflows.writeable = WORKFLOW_WRITEABLE;
    }

    /**
     * Parse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    parse (buildOptions, fn) {
      super.parse(buildOptions, (err) => {
        if (err) return fn(err);
        // Add sidecar json file
        const sidecarData = super.parseSidecarDependency();
        // Parse includes
        let matches = uniqueMatch(this.content, RE_INCLUDE)
          .map((match) => {
            match.id = match.match;
            return match;
          });

        if (sidecarData) matches.push(sidecarData);
        super.addDependencies(matches, buildOptions);
        fn();
      });
    }

    /**
     * Inline css/img/js dependency content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineInlineable (buildOptions, fn) {
      // Only dependencies
      parallel([...this.getAllDependencies()].reduce((inlineable, file) => {
        if (file instanceof HANDLEBARSFile && this.dependencyReferences.length) {
          inlineable.push(callable(file, 'inline', buildOptions));
        }
        return inlineable;
      }, []), fn);
    }

    /**
     * Inline partials content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inlineIncludes (buildOptions, fn) {
      [...this.getAllDependencies(), this].forEach((file) => {
        if (file instanceof HANDLEBARSFile && file.dependencyReferences.length) {
          let content = file.content;

          file.dependencyReferences.forEach((reference) => {
            if (reference.file && reference.context) {
              content = content.replace(new RegExp(regexpEscape(reference.context), 'g'), reference.file.content);
            }
          });

          file.setContent(content);
        }
      });
      fn();
    }

    /**
     * Compile file contents
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     * @returns {null}
     */
    compile (buildOptions, fn) {
      try {
        const options = Object.assign({}, DEFAULT_OPTIONS, this.options.pluginOptions.handlebars);
        const template = handlebars.compile(this.content, options);

        this.setContent(template(this.findSidecarDependency()));
        debug(`compile: ${strong(this.relpath)}`, 4);
        fn();
      } catch (err) {
        if (!this.options.runtimeOptions.watch) return fn(err);
        error(err, 4, false);
      }
    }

    /**
     * Reparse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Array} ignoredFiles
     *  - {Boolean} helpers
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    reparse (buildOptions, fn) {
      this.allDependencies = null;
      this.allDependencyReferences = null;
      this.dependencies = [];
      this.dependencyReferences = [];

      super.parse(buildOptions, fn);
    }
  };
}
956665
function init(options) {

    var fs = require('fs');
    var path = require('path');
    var rootdir = path.dirname(require.main);
    var options = options || {
        config: require(path.join(rootdir, 'config.json')),
        root: rootdir,
        callback: function (noop) {}
    };
    var def = {};
    function ModulePaths (moduledir) {
        this.moduledir = moduledir;
    }

    ModulePaths.prototype.then = function (accept, reject) {
      var moduledir = this.moduledir;
      fs.readdir(moduledir, function (err, files) {
        if (err) reject(err);
        files.forEach(function (file) {
            var name = path.basename(file, '.js');
            def[name] = path.join(moduledir, name);
        });
        accept();
      });
    };
    var pubpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'public', 'js'));
    var prvpath = new ModulePaths(path.join(path.dirname(module.filename), '..', 'private', 'js'));

    Promise.all([pubpath, prvpath])
        .then(function () {
            var requirejs = require('requirejs');
            requirejs.config({
                baseUrl: path.join(rootdir),
                paths: def
            });

            requirejs(['loader_factory'], function (LoaderFactory) {
                var fs = require('fs');
                var config = options.config;
                config.paths.push(path.dirname(pubpath.moduledir));
                var loader = 'loader_express';
                var db = 'db_mongo';
                if (config.loader) loader = config.loader;
                if (config.db) db = config.db;

                new LoaderFactory().create(loader, db, function (loader) {
                    loader.init(config, options.callback);
                });
            });
        })
    .catch(function (err) {
        console.error('err:', err);
    });
}
853773
function buildJS(src, filename, dest, applyHeader, forceIncludePaths) {
  dest = dest || config.dist.jsPath;
  applyHeader = applyHeader || false;
  forceIncludePaths = forceIncludePaths || false;

  return gulp.src(src)
    .pipe(gulpif(
      forceIncludePaths,
      include({
        includePaths: [
          path.dirname(src),
          __dirname,
          config.packagesPath
        ]
      }),
      include()
    ))
    .on('error', console.log) // eslint-disable-line no-console
    .pipe(babel())
    .pipe(uglify({
      output: {
        // try to preserve non-standard headers (e.g. from objectFitPolyfill)
        comments: /^(!|---)/
      }
    }))
    .pipe(gulpif(applyHeader, header(config.prj.header, {
      config: config
    })))
    .pipe(rename(filename))
    .pipe(gulp.dest(dest));
}
798353
function createSourceFilesMiddleware (filesPromise, serveFile, basePath, urlRoot) {
  return function (request, response, next) {
    const requestedFilePath = composeUrl(request.url, basePath, urlRoot)
    // When a path contains HTML-encoded characters (e.g %2F used by Jenkins for branches with /)
    const requestedFilePathUnescaped = composeUrl(querystring.unescape(request.url), basePath, urlRoot)

    request.pause()

    log.debug(`Requesting ${request.url}`)
    log.debug(`Fetching ${requestedFilePath}`)

    return filesPromise.then(function (files) {
      // TODO(vojta): change served to be a map rather then an array
      const file = findByPath(files.served, requestedFilePath) || findByPath(files.served, requestedFilePathUnescaped)
      const rangeHeader = request.headers['range']

      if (file) {
        const acceptEncodingHeader = request.headers['accept-encoding']
        const matchedEncoding = Object.keys(file.encodings).find(
          (encoding) => new RegExp(`(^|.*, ?)${encoding}(,|$)`).test(acceptEncodingHeader)
        )
        const content = file.encodings[matchedEncoding] || file.content

        serveFile(file.contentPath || file.path, rangeHeader, response, function () {
          if (/\?\w+/.test(request.url)) {
            common.setHeavyCacheHeaders(response) // files with timestamps - cache one year, rely on timestamps
          } else {
            common.setNoCacheHeaders(response) // without timestamps - no cache (debug)
          }
          if (matchedEncoding) {
            response.setHeader('Content-Encoding', matchedEncoding)
          }
        }, content, file.doNotCache)
      } else {
        next()
      }

      request.resume()
    })
  }
}
667074
function buildScript(file, watch) {
  var props = {
    entries: [ 'example/_src/jsx/app.js'],
    debug : false,
    transform:  [babelify]
  };

  // watchify() if watch requested, otherwise run browserify() once
  var bundler = watch ? watchify(browserify(props)) : browserify(props);


  function rebundle() {
    var stream = bundler.bundle();
    return stream
      .on('error', handleErrors)
      .pipe(source(file))
      // .pipe(gulp.dest(exampleDir + '/js/'))
      // If you also want to uglify it
      .pipe(buffer())
      // .pipe(uglify())
      .pipe(rename('app.js'))
      .pipe(gulp.dest('example/js/'))
      // .pipe(reload({stream:true}))
  }

  // listen for an update and run rebundle
  bundler.on('update', function() {
    rebundle();
    gutil.log('Rebundle...');
  });

  // run it once the first time buildScript is called
  return rebundle();
}
1035577
function() {
    return gulp
      .src(item.src)
      .pipe(sourcemaps.init())
      .pipe(concat(item.name + '.js'))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest(item.dest));
  }
1244287
function define(File, utils) {
  return class CSSFile extends File {
    /**
     * Constructor
     * @param {String} id
     * @param {String} filepath
     * @param {Object} options
     *  - {Function} buildFactory
     *  - {Object} fileCache
     *  - {Object} fileExtensions
     *  - {Function} fileFactory
     *  - {Array} npmModulepaths
     *  - {Object} pluginOptions
     *  - {Object} runtimeOptions
     *  - {String} webroot
     */
    constructor(id, filepath, options) {
      super(id, filepath, 'css', options);

      this.workflows.inlineable = WORKFLOW_INLINEABLE;
      this.workflows.writeable = WORKFLOW_WRITEABLE;
    }

    /**
     * Parse file contents for dependency references
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     * @returns {null}
     */
    parse(buildOptions, fn) {
      if (this.isInline || !buildOptions.bundle) return fn();

      super.addDependencies(
        uniqueMatch(commentStrip(this.content), RE_IMPORT).map(match => {
          match.id = match.match;
          return match;
        }),
        buildOptions
      );
      fn();
    }

    /**
     * Inline '@import' content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    inline(buildOptions, fn) {
      inline(this);
      debug(`inline: ${strong(this.relpath)}`, 4);
      fn();
    }

    /**
     * Transpile content
     * @param {Object} buildOptions
     *  - {Boolean} batch
     *  - {Boolean} bootstrap
     *  - {Boolean} boilerplate
     *  - {Boolean} browser
     *  - {Boolean} bundle
     *  - {Boolean} compress
     *  - {Boolean} helpers
     *  - {Array} ignoredFiles
     *  - {Boolean} import
     *  - {Boolean} watchOnly
     * @param {Function} fn(err)
     */
    transpile(buildOptions, fn) {
      const postcssOptions = Object.assign(
        { from: this.filepath },
        this.hasMaps ? { map: { annotation: false, inline: false, prev: this.map, sourcesContent: true } } : {},
        this.options.pluginOptions.postcss
      );
      const plugins = postcssOptions.plugins.slice().map(plugin => {
        return Array.isArray(plugin) ? plugin[0](plugin[1]) : plugin;
      });

      delete postcssOptions.plugins;

      transpile(this.content, this.filepath, plugins, postcssOptions, (err, results) => {
        if (err) {
          if (!this.options.runtimeOptions.watch) return fn(err);
          error(err, 4, false);
        }

        const { code: content, map } = results;

        this.setContent(content);
        if (map) this.setMap(map);
        debug(`transpile: ${strong(this.relpath)}`, 4);
        fn();
      });
    }
  };
}
857095
function litmus() {
  var awsURL = !!CONFIG && !!CONFIG.aws && !!CONFIG.aws.url ? CONFIG.aws.url : false;

  return gulp.src('dist/**/*.html')
    .pipe($.if(!!awsURL, $.replace(/=('|")(\/?assets\/img)/g, "=$1"+ awsURL)))
    .pipe($.litmus(CONFIG.litmus))
    .pipe(gulp.dest('dist'));
}
348682
function(callback) {
			fs.appendFileSync(outputFile,";(function(root,factory){\r\n")
			fs.appendFileSync(outputFile,"    if (typeof define === 'function' && define.amd) {\r\n")
			fs.appendFileSync(outputFile,"        define([], factory);\r\n")
			fs.appendFileSync(outputFile,"    } else if (typeof exports === 'object') {\r\n")
			fs.appendFileSync(outputFile,"        module.exports = factory();\r\n")
			fs.appendFileSync(outputFile,"    } else {\r\n")
			fs.appendFileSync(outputFile,"        if (typeof root === 'undefined' || root !== Object(root)) {\r\n")
			fs.appendFileSync(outputFile,"            throw new Error('puglatizer: window does not exist or is not an object');\r\n")
			fs.appendFileSync(outputFile,"        }\r\n")
			fs.appendFileSync(outputFile,"        root.puglatizer = factory();\r\n")
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"}(this, function () {\r\n")
			fs.appendFileSync(outputFile,"    function pug_classes_object(val) { var classString = '', padding = ''; for (var key in val) { if (key && val[key] && pug_has_own_property.call(val, key)) { var classString = classString + padding + key; var padding = ' '; } } return classString; }")
			fs.appendFileSync(outputFile,"    function pug_classes_array(val, escaping) { var classString = '', className, padding = '', escapeEnabled = Array.isArray(escaping); for (var i = 0; i < val.length; i++) { var className = pug_classes(val[i]); if (!className) continue; escapeEnabled && escaping[i] && (className = pug_escape(className)); var classString = classString + padding + className; var padding = ' '; } return classString; }")
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.merge.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.classes.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.style.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attr.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.attrs.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + '\r\n')
			fs.appendFileSync(outputFile,"    " + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    var pug = {\r\n")
			fs.appendFileSync(outputFile,"    	merge:" + minify.js(pug.runtime.merge.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	classes:" + minify.js(pug.runtime.classes.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	style:" + minify.js(pug.runtime.style.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attr:" + minify.js(pug.runtime.attr.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	attrs:" + minify.js(pug.runtime.attrs.toString()) + ',\r\n')
			fs.appendFileSync(outputFile,"    	escape:" + minify.js(pug.runtime.escape.toString()).replace('pug_match_html','(/[\"&<>]/)') + ',\r\n')
			fs.appendFileSync(outputFile,"    	rethrow:" + minify.js(pug.runtime.rethrow.toString()) + '\r\n')
			fs.appendFileSync(outputFile,"    }\r\n")
			fs.appendFileSync(outputFile,"\r\n")
			fs.appendFileSync(outputFile,'    var puglatizer = {}')
			fs.appendFileSync(outputFile,"\r\n")
			return callback()
		}