I am working on a project in angularJs and I am unable to think of a way in which I minifiy a file during rendering. Is there any way in javascript or angular ? Please help I am a newbie
1 Answer
you have to minimify before, for this you can use plenty of tools online :
https://javascript-minifier.com/
Use js minimify tool directly with node js :
https://github.com/mishoo/UglifyJS2
Use a task runner like gulp or grunt with minimify plugin:
or use webpack to bundle and minimify your website or application:
4 Comments
Usman Iqbal
is there any other way apart from online tools ?
Emil S. Jørgensen
All brilliant tools! If you need something with an interface, you can download Koala.
Gatsbill
yeah uglify2 is pretty good, you just have to install node&npm install uglify with 'npm install uglify-js -g' and then just do in a terminal 'uglifyjs yourFilePath' see the doc in my answer
Gatsbill
Then use webpack, gulp, grunt, brocoli or other tool. They create automatic tasks that run with a single command line.