<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/" 
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" 
	xmlns:admin="http://webns.net/mvcb/" 
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/" 
	xmlns:atom="http://www.w3.org/2005/Atom">
	
	<channel>
	
		<title>Make A JavaScript Formatter with V8 and jsbeautifier</title>
		<link>http://www.sencha.com/blog/make-a-javascript-formatter-with-v8-and-jsbeautifier</link>
		<description>Ariya Hidayat explains how to use a handy online tool called JSBeautifier which automatically reformats and reindents your JavaScript code (or JSON snippets) based on spacing, packing, and other configureable options.</description>
		<dc:language>en-us</dc:language>
		<dc:creator>ariya@sencha.com</dc:creator>
		<dc:rights>Copyright 2010</dc:rights>
		<dc:date>2010-10-21T15:00:31+00:00</dc:date>
		<admin:generatorAgent rdf:resource="http://expressionengine.com/" />
		<atom:link href="http://www.sencha.com/blog/comments-rss/663" rel="self" type="application/rss+xml" />
  
		
  
		<item>
      <title>Comment by Ashton</title>
      <description>thanks for the tool. I am just starting javascript and its good to have this tool at this early.</description>
      <content:encoded><![CDATA[<p>thanks for the tool. I am just starting javascript and its good to have this tool at this early.</p>]]></content:encoded>
      <pubDate>Fri, 16 Sep 2011 14:36 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:27214#date:14:36</guid>
    </item>
  
		<item>
      <title>Comment by Spike</title>
      <description>At last! Someone who undrestands! Thanks for posting!</description>
      <content:encoded><![CDATA[<p>At last! Someone who undrestands! Thanks for posting!</p>]]></content:encoded>
      <pubDate>Mon, 06 Jun 2011 00:42 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:22480#date:00:42</guid>
    </item>
  
		<item>
      <title>Comment by jlbfalcao</title>
      <description>... and a Textmate bundle.

http://github.com/jlbfalcao/js&#45;beautify&#45;v8.tmbundle</description>
      <content:encoded><![CDATA[<p>... and a Textmate bundle.</p>

<p><a href="http://github.com/jlbfalcao/js-beautify-v8.tmbundle">http://github.com/jlbfalcao/js-beautify-v8.tmbundle</a></p>]]></content:encoded>
      <pubDate>Sun, 31 Oct 2010 17:21 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16449#date:17:21</guid>
    </item>
  
		<item>
      <title>Comment by jlbfalcao</title>
      <description>My homebrew formula

http://github.com/jlbfalcao/homebrew/commit/a10a73e0f54c21aa38329cdfe0f2f8e331aa3712</description>
      <content:encoded><![CDATA[<p>My homebrew formula</p>

<p><a href="http://github.com/jlbfalcao/homebrew/commit/a10a73e0f54c21aa38329cdfe0f2f8e331aa3712">http://github.com/jlbfalcao/homebrew/commit/a10a73e0f54c21aa38329cdfe0f2f8e331aa3712</a></p>]]></content:encoded>
      <pubDate>Sun, 31 Oct 2010 14:44 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16448#date:14:44</guid>
    </item>
  
		<item>
      <title>Comment by Sergiu</title>
      <description>Or you can use Aptana &#45;&amp;nbsp; CTRL&#45;SHIFT&#45;F</description>
      <content:encoded><![CDATA[<p>Or you can use Aptana -&nbsp; CTRL-SHIFT-F</p>]]></content:encoded>
      <pubDate>Tue, 26 Oct 2010 07:21 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16447#date:07:21</guid>
    </item>
  
		<item>
      <title>Comment by Animal</title>
      <description>@Ariya, loving your self&#45;restraint!</description>
      <content:encoded><![CDATA[<p>@Ariya, loving your self-restraint!</p>]]></content:encoded>
      <pubDate>Sat, 23 Oct 2010 07:49 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16446#date:07:49</guid>
    </item>
  
		<item>
      <title>Comment by Ariya Hidayat</title>
      <description>@Enc. Thanks for the feedback! This is not the last blog post in this series and we&#8217;ll cover more advanced and useful stuff (and yes, I&#8217;ve done syntax tree&#45;related stuff as well) as we go along.</description>
      <content:encoded><![CDATA[<p>@Enc. Thanks for the feedback! This is not the last blog post in this series and we&#8217;ll cover more advanced and useful stuff (and yes, I&#8217;ve done syntax tree-related stuff as well) as we go along.</p>]]></content:encoded>
      <pubDate>Fri, 22 Oct 2010 14:14 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16445#date:14:14</guid>
    </item>
  
		<item>
      <title>Comment by Mischa Kroon</title>
      <description>Rhino (javascript engine used by java) seems like the easier option, allthough it probably has quite a bit of overhead.</description>
      <content:encoded><![CDATA[<p>Rhino (javascript engine used by java) seems like the easier option, allthough it probably has quite a bit of overhead.</p>]]></content:encoded>
      <pubDate>Fri, 22 Oct 2010 11:01 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16444#date:11:01</guid>
    </item>
  
		<item>
      <title>Comment by Enc</title>
      <description>I would like to respectfully disagree with anyone who thinks that this article is in any way close to &#8220;cool&#8221;.
A _cool_ article or, in other words, a useful, informative and insightful article, would actually contain information that is more useful than a stub page on Wikipedia.

This article teaches &#8216;JavaScript&#8217; developers who supposedly don&#8217;t know any better or are not that good with C++ that it&#8217;s not such a bad idea to create a command line tool in C++ that embeds a JavaScript interpreter written in C++ to run a JavaScript parser script written in JavaScript to format JavaScript code.

Well, I have news for you: that is not in any way _cool_ or useful. In fact, it&#8217;s redundant, unnecessary, a misuse of jsbeautifier and a waste of resources.

To see why, let&#8217;s take this article even further in ridiculousness. So far we&#8217;ve got a command line tool embedding V8 to run a JS script that parses JS code and outputs the result. Now, create a virtual machine to virtualize this tool and host the VM on Amazon, provide a REST API for your users to POST their code with curl and pipe the XML output to an XSLT processor which will use an XSL stylesheet to format the XML and transform it back to properly indented and colorized JavaScript.

If you still think that the above is _cool_ and not outrageous, then you have failed.

Obviously, one might argue that the goal was to show how to embed V8 and run some JavaScript code in it. In that case, I still question the usefulness of this article, since it could have been simply reduced to the following sentence: &#8220;RTFM @ http://code.google.com/apis/v8/embed.html&#8221;.

A more useful article for creating a command&#45;line JavaScript &#8220;beautifier&#8221; using V8 would have been one that explains how to reuse functionality from V8 (mainly the parse tree I imagine it must construct) to print properly indented and highlighted JavaScript code, without actually wasting resources on interpreting any of it. 

Overall, I say 100/100 for the good intentions and initiative, but a 50/100 for the content.</description>
      <content:encoded><![CDATA[<p>I would like to respectfully disagree with anyone who thinks that this article is in any way close to &#8220;cool&#8221;.<br />
A _cool_ article or, in other words, a useful, informative and insightful article, would actually contain information that is more useful than a stub page on Wikipedia.</p>

<p>This article teaches &#8216;JavaScript&#8217; developers who supposedly don&#8217;t know any better or are not that good with C++ that it&#8217;s not such a bad idea to create a command line tool in C++ that embeds a JavaScript interpreter written in C++ to run a JavaScript parser script written in JavaScript to format JavaScript code.</p>

<p>Well, I have news for you: that is not in any way _cool_ or useful. In fact, it&#8217;s redundant, unnecessary, a misuse of jsbeautifier and a waste of resources.</p>

<p>To see why, let&#8217;s take this article even further in ridiculousness. So far we&#8217;ve got a command line tool embedding V8 to run a JS script that parses JS code and outputs the result. Now, create a virtual machine to virtualize this tool and host the VM on Amazon, provide a REST API for your users to POST their code with curl and pipe the XML output to an XSLT processor which will use an XSL stylesheet to format the XML and transform it back to properly indented and colorized JavaScript.</p>

<p>If you still think that the above is _cool_ and not outrageous, then you have failed.</p>

<p>Obviously, one might argue that the goal was to show how to embed V8 and run some JavaScript code in it. In that case, I still question the usefulness of this article, since it could have been simply reduced to the following sentence: &#8220;RTFM @ <a href="http://code.google.com/apis/v8/embed.html">http://code.google.com/apis/v8/embed.html&#8221;</a>.</p>

<p>A more useful article for creating a command-line JavaScript &#8220;beautifier&#8221; using V8 would have been one that explains how to reuse functionality from V8 (mainly the parse tree I imagine it must construct) to print properly indented and highlighted JavaScript code, without actually wasting resources on interpreting any of it. </p>

<p>Overall, I say 100/100 for the good intentions and initiative, but a 50/100 for the content.</p>]]></content:encoded>
      <pubDate>Fri, 22 Oct 2010 04:01 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16443#date:04:01</guid>
    </item>
  
		<item>
      <title>Comment by Mango_lier</title>
      <description>I built a plugin for PSPad based on Einar&#8217;s code. You can pull in a file in the editor and select format from the menu.

Download: http://www.pspad.com/files/pspad/rozsireni/181&#45;js_beautify.zip</description>
      <content:encoded><![CDATA[<p>I built a plugin for PSPad based on Einar&#8217;s code. You can pull in a file in the editor and select format from the menu.</p>

<p>Download: <a href="http://www.pspad.com/files/pspad/rozsireni/181-js_beautify.zip">http://www.pspad.com/files/pspad/rozsireni/181-js_beautify.zip</a></p>]]></content:encoded>
      <pubDate>Fri, 22 Oct 2010 00:39 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16442#date:00:39</guid>
    </item>
  
		<item>
      <title>Comment by Ariya Hidayat</title>
      <description>@Bill: Pass &#8216;arch=x64&#8217;, i.e. use &#8216;scons mode=release arch=x64&#8217; to build V8 (it&#8217;s omitted in this blog post, but somehow mentioned in the js&#45;beautify repo&#8217;s README.txt ).</description>
      <content:encoded><![CDATA[<p>@Bill: Pass &#8216;arch=x64&#8217;, i.e. use &#8216;scons mode=release arch=x64&#8217; to build V8 (it&#8217;s omitted in this blog post, but somehow mentioned in the js-beautify repo&#8217;s README.txt ).</p>]]></content:encoded>
      <pubDate>Thu, 21 Oct 2010 19:42 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16441#date:19:42</guid>
    </item>
  
		<item>
      <title>Comment by Bill</title>
      <description>This is probably me missing something stupid, but I get this error when trying to compile the beautifer  (using a MacBook Pro):

ld: warning: in lib/libv8.a, file was built for unsupported file format which is not the architecture being linked (x86_64)</description>
      <content:encoded><![CDATA[<p>This is probably me missing something stupid, but I get this error when trying to compile the beautifer  (using a MacBook Pro):</p>

<p>ld: warning: in lib/libv8.a, file was built for unsupported file format which is not the architecture being linked (x86_64)</p>]]></content:encoded>
      <pubDate>Thu, 21 Oct 2010 19:05 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16440#date:19:05</guid>
    </item>
  
		<item>
      <title>Comment by Albert</title>
      <description>thanks. this is pretty cool stuff</description>
      <content:encoded><![CDATA[<p>thanks. this is pretty cool stuff</p>]]></content:encoded>
      <pubDate>Thu, 21 Oct 2010 16:50 GMT</pubDate>
      <guid isPermaLink="false">http://www.sencha.com/blog//make-a-javascript-formatter-with-v8-and-jsbeautifier#id:16439#date:16:50</guid>
    </item>
  
		
	</channel>
</rss>