#!/usr/bin/env node

const
  fs = require('fs');

/* Remove all white space from str. */
function minifyString(str) {
  return str.replace(/\s/g, '');
};

/* Insert .min extension to FileName. */
function addMinExtension(FileName) {
  var fileExtIndex = FileName.indexOf('.')
    , filePrefix   = FileName.slice(0, fileExtIndex)
    , fileExten    = FileName.slice(fileExtIndex, FileName.length)
    , minFileName  = filePrefix + '.min' + fileExten;

  return minFileName;
};

/* Removes white space from file and writes minified data to a new file. */
(function main() {

  /* Read the file into a string */
  var filePath       = process.argv[2]
    , fileContent    = fs.readFileSync(filePath, 'utf8')
    , minFileContent = minifyString(fileContent)
    , minFileName    = addMinExtension(filePath);

  var minifiedFile = fs.writeFile(minFileName, minFileContent, function(err) {
    if (err) { throw err; };
    console.log('-- ' + filePath + ' minified to ' + minFileName + ' --');
  });
})();

const
  fs = require('fs');

/* Remove all white space from str. */
function minifyString(str) {
 return str.replace(/\s/g, '');
};

/* Insert .min extension to FileName. */
function addMinExtension(FileName) {
  var fileExtIndex = FileName.indexOf('.')
    , filePrefix   = FileName.slice(0, fileExtIndex)
    , fileExten    = FileName.slice(fileExtIndex, FileName.length)
    , minFileName  = filePrefix + '.min' + fileExten;

  return minFileName;
};

/* Removes white space from file and
   writes new minified file. */
(function main() {

  /* Read the file into a string */
  var filePath       = process.argv[2]
    , fileContent    = fs.readFileSync(filePath, 'utf8')
    , minFileContent = minifyString(fileContent)
    , minFileName    = addMinExtension(filePath);

  var minifiedFile = fs.writeFile(minFileName, minFileContent, function(err) {
    if (err) { throw err; };
    console.log('-- ' + filePath + ' minified to ' + minFileName + ' --');
  });
})();

--- 
+++ 
@@ -1,9 +1,11 @@
+#!/usr/bin/env node
+
 const
   fs = require('fs');
 
 /* Remove all white space from str. */
 function minifyString(str) {
- return str.replace(/\s/g, '');
+  return str.replace(/\s/g, '');
 };
 
 /* Insert .min extension to FileName. */
@@ -16,8 +18,7 @@
   return minFileName;
 };
 
-/* Removes white space from file and
-   writes new minified file. */
+/* Removes white space from file and writes minified data to a new file. */
 (function main() {
 
   /* Read the file into a string */
Add node env location to script header.
