Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js
What Does Minification Do?
Obfuscating variables means it will take any variables and change the name to something smaller. Usually it starts with "a" and then goes to "b" and so on. Your variables will still work like always but now will take up less space.
How Do I Minify?
There are several programs out there to minify your files. The one we will focus on today is YUI Compressor. There will be links at the end of the article to this and others like it. The YUI compressor is by Yahoo! and has been around a long time.
The first step is to download the YUI Compressor and un-pack it. The YUI Compressor uses Java so you will need to make sure you have Java on your system.
I am using Windows 7 x64 so it may be a little different for your operating system. After YUI Compressor is downloaded and un-packed, it is time to start the process. First you will need to open a command prompt. To do this on Windows 7, click the start button, go to All Programs, then to Accessories, and then click on Command Prompt (see figure 1).
You should have a command prompt window open. Next we want to add the folder where Java is located to the path so it will be easier to reference. You can also add this to the global path so you do not have to do this step every time. In the command prompt window, enter the following command:
path %path%;C:Program Files (x86)Javajre6bin
Of course, the Java path may be different for you.
java -jar C:yuicompressor-2.4.2build yuicompressor-2.4.2.jar script.js -o script.min.js
The first part "java" calls Java to execute the jar file. The jar file's location may be different than my location depending on where you extracted the file. The next part is the script you want to minify. The "-o" option specifies the location of the output file.
That Seems Hard, Is There an Easier Way?
Sure there are easier ways to do this. There are several GUI and other options for your operating system. Just do a search for YUI Compressor and then your operating system. There are even add-ons for Visual Studio and other developer tools to do this for you automatically.
YUI Compressor - http://developer.yahoo.com/yui/compressor/
Microsoft AJAX Minifier - http://www.asp.net/ajaxlibrary/AjaxMinDocumentation.ashx