4 Replies Last post: Mar 30, 2013 2:14 AM by Chris Weed  
Philip Tyrer Newbie 9 posts since
Mar 13, 2013
Currently Being Moderated

Mar 16, 2013 7:05 PM

Setting up YUI watcher

Ok, so last thread I posted got me up and running with a LESS watcher with Node. Now I would like to use YUI for compressing CSS and possibly JS. I have installed YUI via the Node.js console but I can't find where the "program" is for the Watcher.

 

C:\Users\[user]\AppData\Roaming\npm\

 

is where the lassc.cmd file is for a LESS watcher but there is no YUI cmd there.

 

So how does one get a YUI watcher working under Windows?

Andriy Bazanov Master 2,752 posts since
May 28, 2010
Currently Being Moderated
Mar 16, 2013 9:21 PM in response to: Philip Tyrer
Re: Setting up YUI watcher

Hi there,

 

AFAIK, YUI (actual library) and YUICompressor (minifying/optimizing tool) are two different things.

 

You can get latest version of YUICompressor from https://github.com/yui/yuicompressor/downloads

 

So ...

  1. Download YUICompressor and extract it somewhere.
  2. When creating YUI Watcher -- just point to the extracted jar file in "Program" field
  3. That's it -- as long as you have java on your system it should work just fine (on Windows PhpStorm/WebStorm will use the one that comes bundled with IDE).

 

You may use nodejs version of yuicompressor ( https://github.com/yui/yuicompressor ) but:

  • I do not think that it has separate command/file for execution from outside of nodejs
  • it still uses java under the hood

This makes nodejs version of it not really useful for outside-of-nodejs usage.

Andriy Bazanov Master 2,752 posts since
May 28, 2010
Currently Being Moderated
Mar 16, 2013 9:13 PM in response to: Philip Tyrer
Re: Setting up YUI watcher

Well ... technically it should be

Programm: java.exe

Parameters: -jar path/to/yuicompressor.jar --other_params

But File Watchers plugin is smart enough to accept .jar file in "Program" field and build the correct final command line automatically. This also makes setting up new file watcher entry much easier (especially for those who have never used yuicompressor (and file watcher) before).

Chris Weed Newbie 1 posts since
Mar 30, 2013
Currently Being Moderated
Mar 30, 2013 2:14 AM in response to: Philip Tyrer
Re: Setting up YUI watcher

The help is very misleading:

http://www.jetbrains.com/phpstorm/webhelp/minifying-css.html

 

It states that if you install everything with npm, the file watcher will automatically fill in the fields.  Well of course that didn't work for me, so I had no idea where to go.  It seemed very strange that the instructions mentioned a .jar file.  Read it for yourself and see if you are just as confused as I am.

 

So yes, basically ignore all mentions of npm in the help documentation and just download the .jar file.  This also applies to the Google Closure (I use it to compress my js files).

More Like This

  • Retrieving data ...