/*jslint node: true, nomen: true, white: true, unparam: true, stupid: true*/
/*!
 * Sitegear3
 * Copyright(c) 2014 Ben New, Sitegear.org
 * MIT Licensed
 */

(function (_, path, fs) {
	"use strict";

	var utils = {
		loadPathAsGetters: function (object, scanPath) {
			if (!scanPath) {
				scanPath = object;
				object = {};
			}
			_.each(fs.readdirSync(scanPath), function (filename) {
				if (/\.js/.test(filename)) {
					var name = path.basename(filename, '.js');
					object.__defineGetter__(name, function () {
						return require(path.join(scanPath, name));
					});
				}
			});
			return object;
		},

		expandSettings: function (originalSettings, settings) {
			// This function is not optimised as it is only called once (plus recursive calls) at application startup.
			if (!settings) {
				settings = originalSettings;
			}
			var regex = /^([\w\W]*?)\{\{\s*([\w\.\-]*)\s*\}\}([\w\W]*?)$/;
			_.each(settings, function (childSettings, childSettingsKey) {
				if (_.isPlainObject(childSettings) || _.isArray(childSettings)) {
					settings[childSettingsKey] = utils.expandSettings(originalSettings, childSettings);
				} else if (_.isString(childSettings)) {
					var replacementKey, replacementValue,
						doReplacement = function (replacementKeyComponent) {
							replacementValue = replacementValue && replacementValue.hasOwnProperty(replacementKeyComponent) ? replacementValue[replacementKeyComponent] : null;
						};
					while (regex.test(childSettings)) {
						replacementKey = childSettings.replace(regex, '$2');
						replacementValue = originalSettings;
						_.each(replacementKey.split('.'), doReplacement);
						childSettings = replacementValue ? childSettings.replace(regex, '$1' + replacementValue + '$3') : null;
					}
					settings[childSettingsKey] = childSettings;
				}
			});
			return settings;
		}
	};

	module.exports = utils;
}(require('lodash'), require('path'), require('fs')));

@@ -198,16 +198,21 @@
 ;%0A%0A%09
-var util
+module.export
 s = 
@@ -1073,20 +1073,29 @@
 sKey%5D = 
-util
+module.export
 s.expand
@@ -1856,34 +1856,8 @@
 %0A%09%7D;
-%0A%0A%09module.exports = utils;
 %0A%7D(r

Remove redundant local variable.