Created
October 28, 2017 17:45
-
-
Save pablohpsilva/494c7e85329b38f1d25a4a10d7dcbfd2 to your computer and use it in GitHub Desktop.
load-minified.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var UglifyJS = require('uglify-es') | |
module.exports = function(filePath) { | |
var code = fs.readFileSync(filePath, 'utf-8') | |
var result = UglifyJS.minify(code) | |
if (result.error) return '' | |
return result.code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment