JavaScript Tools Coda Plugin

Posted: December 15, 2008 Comments

Update: JavaScript Tools is no longer maintained by me and is available on GitHub.

One bundle I found myself using consistently within TextMate is JavaScript Tools. The bundle gives you a number of great tools right at your fingertips for working with JavaScript. I decided to begin porting what I can to a Coda plugin.

JavaScript Tools Coda Plugin

One of the most useful parts of the JavaScript Tools bundle was the ability to Minify or Pack your source within TextMate. Having the ability to compress and obfuscate your JavaScript is of great benefit, and I did my part when I could. Minification and Packing are two different technologies, both with pros and cons. I decided to integrate both as they are my tools of choice.

I ran into some issues when putting this plugin together, however. While testing, I was using one of the many jQuery plugins and compression was going great. As I continued my testing, I attempted to Minify jQuery. That’s when things started getting a bit sticky. When invoking the compression of a larger JavaScript file, Coda began to act a bit strange. The application itself would seem to choke and eventually freeze. After a few seconds of locking up, my entire machine would freeze, forcing a hard reboot. I’m currently in contact with Panic to see if there is an issue with my personal machine, or something else entirely.

When working properly, the plugin operates like this:

I hope to work with Panic over the next few days to come up with a solution to the ‘large file problem’ and I’ll post a revision as soon as some new information surfaces. In the meantime, if you’d like to crack open the plugin and see if you spot any red flags, I’d be greatly appreciative. Currently the plugin misbehaves whether you Minify or Pack, so I’m lead to believe it’s an issue outside one class or the other.

Future plans include the incorporation of the YUI Compressor as well as JSLint. After solving the issue of working with larger files, I’m going to work on integrating those technologies.

Download JavaScript Tools

Version 0.5
December 15, 2008 – Initial release

Get my newsletter

Receive periodic updates right in the mail!
  • This field is for validation purposes and should be left unchanged.

Comments

  1. First cool that you convert the tm bundles to coda plugins ! very cool. But I have the same issue like with the comment banner. I am using a mamp version for php, that means I have symlinked my mamp php to the standart Os X installation, which is used by coda (I think so). I need that to do command line execution for several frameworks like symfony. The issue is the error level. Maybe you can use the inbuild error handler of php to catch these notices or surpress all output which is not allowed. I havn’t done this with coda but I will try to solve thise use on the weekend. Its quite interessting. (output buffering is maybe a keyword)

    BR Thomas

  2. Hey,

    I just locked up my system the same way you did.
    Hope you can fix the problem!

    Regards,
    Samy

  3. @Jlevitt: Great suggestions! I’ll add them to my to-do’s.

    @Samuel Vogel: Unfortunately, I haven’t heard back from Panic quite yet, but I’ll continue seeing if there is anything else I can do!

  4. This looks like a wonderful tool, however I’m receiving the following errors:
    Minify:
    Notice: Undefined variable: input in /Users/rob/Library/Application Support/Coda/Plug-ins/JavaScript Tools.codaplugin/Contents/Resources/DE90E0FB-2161-4269-A34B-E46B1BF60E02/minifyjs.php on line 13
    Pack:
    Notice: Undefined variable: input in /Users/rob/Library/Application Support/Coda/Plug-ins/JavaScript Tools.codaplugin/Contents/Resources/606ADC5D-BBD3-4BB3-A4F9-78593FF4FA29/packjs.php on line 13
    Even though it shows the errors in the code, it looks like it is minifying/packing the code, but I have not saved and tested, for fear of the errors.
    Any idea what could be the cause?
    Thanks for giving us such a wonderful tool!

  5. Rob – Those are not errors per se. It’s a notice that the developer has not declared or initialized the variables before using them – which is fine. It is a convention to declare your variables but it’s not a must in all scripting languages.

    Those notices are not affecting the script.

  6. Amazing plugin, makes it easy compressing js files within a few clicks.

    Do you plan to continue this project and including YUI compressor & JSLint, or is this project “dead” ?

  7. I’m hoping this project isn’t dead and that you’ll look to implement YUI Compressor & JSLint as I use both of those religiously!

    If you could email me to let me know either way.

    Many thanks 🙂

  8. Hey everyone, no, this project is definitely not dead. It has been in part shelved due to some other work taking precedence but I’m going to do my best to issue a new release as soon as possible!

  9. I’d LOVE to see this project continued. You’re one of top search results on Google for “Coda YUI” and currently our only hope. Of course I’m pretty close to just writing the plugin myself, but perhaps you’re nearly finished?

    Keep up the good work!!

  10. Hey Eric, I’m definitely not opposed to other people picking up where I left off. In fact I don’t see any reason to not put it on GitHub. I’ll do that this weekend. Please, by all means feel free to contribute!

  11. Great Plugin! Really easy and fast!

    Only thing, that would be great was already mentioned by Jlevitt.
    “Unpack” and “Unminify” 😉

    At the moment I have to make a backup of the packed JavaScript or use http://jsbeautifier.org/ to get my written code back;-)

    But still it’s a really useful Plugin!
    Thank your very much for your work!

Leave a Reply

Your email address will not be published. Required fields are marked *