summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js
diff options
context:
space:
mode:
authortalasila <talasila@research.att.com>2017-02-07 15:03:57 -0500
committertalasila <talasila@research.att.com>2017-02-07 15:05:15 -0500
commit4ad39a5c96dd99acf819ce189b13fec946d7506b (patch)
treea1449286441947cc3d07a45227fa0d6f978e1a7d /ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js
parent5500448cbd1f374d0ac743ee2fd636fe2d3c0027 (diff)
Initial OpenECOMP Portal commit
Change-Id: I804b80e0830c092e307da1599bd9fbb5c3e2da77 Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js')
-rw-r--r--ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js b/ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js
new file mode 100644
index 00000000..7a0082d3
--- /dev/null
+++ b/ecomp-portal-FE/client/bower_components/lodash/lib/common/minify.js
@@ -0,0 +1,39 @@
+'use strict';
+
+var _ = require('lodash'),
+ fs = require('fs-extra'),
+ uglify = require('uglify-js');
+
+var uglifyOptions = require('./uglify.options');
+
+/*----------------------------------------------------------------------------*/
+
+/**
+ * Asynchronously minifies the file at `srcPath`, writes it to `destPath`, and
+ * invokes `callback` upon completion. The callback is invoked with one argument:
+ * (error).
+ *
+ * If unspecified, `destPath` is `srcPath` with an extension of `.min.js`. For
+ * example, a `srcPath` of `path/to/foo.js` would have a `destPath` of `path/to/foo.min.js`.
+ *
+ * @param {string} srcPath The path of the file to minify.
+ * @param {string} [destPath] The path to write the file to.
+ * @param {Function} callback The function invoked upon completion.
+ * @param {Object} [option] The UglifyJS options object.
+ */
+function minify(srcPath, destPath, callback, options) {
+ if (_.isFunction(destPath)) {
+ if (_.isObject(callback)) {
+ options = callback;
+ }
+ callback = destPath;
+ destPath = undefined;
+ }
+ if (!destPath) {
+ destPath = srcPath.replace(/(?=\.js$)/, '.min');
+ }
+ var output = uglify.minify(srcPath, _.defaults(options || {}, uglifyOptions));
+ fs.writeFile(destPath, output.code, 'utf-8', callback);
+}
+
+module.exports = minify;