javascript - How to minification of group of string data in angularjs? -
this code, tried following code not working
var uglifyjs = require("uglify-js"); var result = uglifyjs.minify("hello world @123;", { fromstring: true }); console.log(result.code);
in above code using uglifyjs. got error require undefined
. want minimize above string using angularjs.
var uglifyjs = require("uglify-js");
this code uglify-js , assign variable.
the error require undefined
possible because of not inserting requirejs
in project.
install requirejs
using npm in project directory
$ npm install --save bower-requirejs
check more details on : https://github.com/yeoman/bower-requirejs
notes:
uglifyjs javascript parser, minifier, compressor or beautifier toolkit. not used minifying string.
below basic example has javascript
code not string.
var result = uglifyjs.minify("var b = function () {};", {fromstring: true});
Comments
Post a Comment