HTML, CSS, JavaScript
Javascript minifier recommendations
Gravatar is a globally recognized avatar based on your email address. Javascript minifier recommendations
  Carl Chambers
  All
  Feb 6, 2018 @ 09:12pm

I'm starting to look at code minifiers and was wondering if anyone has any recommendations or experiences that can aid in my search.
I appreciate any input.

Thanks, Carl

Gravatar is a globally recognized avatar based on your email address. re: Javascript minifier recommendations
  Rick Strahl
  Carl Chambers
  Feb 7, 2018 @ 02:51pm

If you're using Visual Studio install Web Essentials or the Bundler & Minifier addin. You can set this up so everytime you make a change to the file it's minified and it works for CSS, JS. It's also part of Web Essentials which also includes Web Compiler for Less and Sass compilers that work the same way.

If you're not using Visual Studio, then the common path usually is to set up a Grunt, Gulp or WebPack build process that can compile all your resources. That's a lot more work though. You can probably find some boiler plate projects on Github that will do basic compression of common assets.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Javascript minifier recommendations
  Carl Chambers
  Rick Strahl
  Feb 8, 2018 @ 09:08am

Thanks Rick,

I'm not using Visual Studio and I'm afraid the other options you provided are a bit over my head at this point.
I'm just looking for a simple utility that can produce a minified output file from an input file.

Gravatar is a globally recognized avatar based on your email address. re: Javascript minifier recommendations
  Rick Strahl
  Carl Chambers
  Feb 8, 2018 @ 02:35pm

Well the problem is that most of those tools require some sort of build setup. They're usually built for Linux and either use Node or Java and those things have to be available.

If you have Node installed UglifyJs and UglifyCss.

Once installed you can do something like this:

> uglifyjs --compress --mangle -- ww.angular.js > ww.angular.min.js

You can also create a bundle by providing multiple file names and they just get appended one after the other.

+++ Rick ---

© 1996-2024