<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8035544231328335854</id><updated>2024-09-09T01:07:03.317-07:00</updated><title type='text'>Adil&#39;s Blogs</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adilsblogs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8035544231328335854/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://adilsblogs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/08156566322830480307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8035544231328335854.post-6683291276681770939</id><published>2012-07-05T22:50:00.000-07:00</published><updated>2012-07-05T23:06:10.412-07:00</updated><title type='text'>Obfuscating multiple js files using YUI Compressor</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Javascript Obfuscation:&lt;/b&gt;&lt;br /&gt;
The word obfuscate means unclear or unintelligible. The Javascript obfuscation refers to converting the Javascript code to an unclear&amp;nbsp;form. This might be needed for security. So others cannot steal your script and use it in their own project. Also the obfuscation reduces the size of the Javascript. So, it might also be used to speed up the website.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Problems with obfuscating multiple files:&lt;/b&gt;&lt;br /&gt;
In most of the web projects we have multiple js files. If you want to obfuscate all of them you need to obfuscate the files one by one. If you select all the files at once the obfuscater will convert it to one single file. In this case the order of js files selection does matter. Also if you decided to obfuscate the code when your project is already developed you&#39;ll have to change the js files links in all your web pages to point to one single obfuscated js file. This will be a headache of course.&lt;br /&gt;
For this there should be some solution that takes the path of js folder and gives the obfuscated files in some other folder. Any such solution will speed up the development. I tried hard to find out such a solution. But none of the online/offline solutions provides this functionality.&lt;br /&gt;
To achieve this I wrote a little java program named&amp;nbsp;ObfuscationWizard. This program will take the path of js folder (source folder), the path of destination folder and the path of &lt;a href=&quot;http://yuilibrary.com/download/yuicompressor/&quot; target=&quot;_blank&quot;&gt;YUICompressor&lt;/a&gt; (this program obfuscates the javascript files).&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://1.bp.blogspot.com/-7i_EFIhddqM/T_Z_UMKHU3I/AAAAAAAAAOg/ihHnqOyMmQE/s1600/edit+me.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;337&quot; src=&quot;http://1.bp.blogspot.com/-7i_EFIhddqM/T_Z_UMKHU3I/AAAAAAAAAOg/ihHnqOyMmQE/s640/edit+me.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Steps to obfuscate the files:&lt;/b&gt;&lt;br /&gt;
-&amp;gt; Download the &lt;a href=&quot;http://yuilibrary.com/download/yuicompressor/&quot; target=&quot;_blank&quot;&gt;YUI compressor&lt;/a&gt; (locate the JAR file in the dist folder you will have to browse to it later).&lt;br /&gt;
-&amp;gt; Download my&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;a href=&quot;https://docs.google.com/open?id=0B-vPxA1FPn2Qa010WXp4VkFPOUU&quot; target=&quot;_blank&quot;&gt;ObfuscationWizard&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;-&amp;gt; Run the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;ObfuscationWizard JAR file (exists in dist folder), provide all three paths and click the &#39;Get Obfuscation Commands Now&#39; button.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;-&amp;gt; In the right-side textarea you&#39;ll get some commands. Just copy all the commands.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;-&amp;gt; Run command prompt and paste the commands into it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;You are done!! the obfuscated files have been created in your destination folder. Cheers :)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;Possible Problem(s):&lt;/b&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;If you have never run java from command line before, you might see some errors. In that case you&#39;ll have to set up your environment variables first. You can hopefully find a lot of help about that on google. If not, please leave a comment. I&#39;ll probably write a post for that as well.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white;&quot;&gt;If you have moved any of the JAR files out of the dist folder you will not be able to run the program.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Ctrl+V doesn&#39;t work on command prompt. Just right click and click &#39;paste&#39;.&lt;/li&gt;
&lt;li&gt;On&amp;nbsp;
&lt;a href=&quot;https://docs.google.com/open?id=0B-vPxA1FPn2Qa010WXp4VkFPOUU&quot; target=&quot;_blank&quot;&gt;ObfuscationWizard&lt;/a&gt;&amp;nbsp;link you may not see the download link. Just press Ctrs+S and the rar file will be downloaded. If it doesn&#39;t work either, just bellow the file name click File and then click Download.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adilsblogs.blogspot.com/feeds/6683291276681770939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://adilsblogs.blogspot.com/2012/07/obfuscating-multiple-js-files-using-yui.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8035544231328335854/posts/default/6683291276681770939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8035544231328335854/posts/default/6683291276681770939'/><link rel='alternate' type='text/html' href='http://adilsblogs.blogspot.com/2012/07/obfuscating-multiple-js-files-using-yui.html' title='Obfuscating multiple js files using YUI Compressor'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/08156566322830480307</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-7i_EFIhddqM/T_Z_UMKHU3I/AAAAAAAAAOg/ihHnqOyMmQE/s72-c/edit+me.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>