How do you automagically minify your JS and CSS on OS X or in Webstorm?

11,164

Solution 1

For those who have now updated to WebStorm 6, this functionality is in-built. Simply go to File (or whatever the Mac equivalent is) -> Settings -> File Watchers and define a file watcher for the type of file you need to watch.

The relevant help documentation is here - http://www.jetbrains.com/webstorm/webhelp/using-file-watchers.html

Solution 2

You could use YUI Compressor without Command Line with these little Apps:

Solution 3

I use lessc and uglifyjs to concatenate and minify my css and js files. Here's a makefile from Twitter Bootstrap that I used a modified version of:

https://github.com/twitter/bootstrap/blob/master/Makefile

It's simple since all I do is type make in the command line whenever I want to compile.

Solution 4

I use Minify. It's on the Mac App Store.

I developed it to support my own workflow. minifyapp.com

Solution 5

I'm neither a Mac nor Webstorm user, but this might still be relevant.

For javascript I use the closure compiler as part of an upload script to minify. It doesn't monitor the files, it runs when I run the upload (a bash file).

If you wanted to keep it all in the IDE, it looks like Webstorm has an Ant plugin http://plugins.intellij.net/plugin/?webide&id=4526 that you could use to execute the closure compiler.

If you can find a command line css minifier then you could put that in the Ant script as well.

Share:
11,164
Chase Florell
Author by

Chase Florell

I'm a developer in BC Canada and one of the owners of Flo Media Group Inc. I work primarily in C# .NET, Xamarin, HTML5 and Javascript, and I'm also very passionate about DevOps, and have been known to sling my fair share of PowerShell. When I'm not coding, I'm enjoying time with my wonderful wife and children, riding my motorcycle, camping in the summer months, snowboarding in the winter, or maybe just a round at the Golf Course. I Blog Here, and I'm also on Linkedin Contact Me

Updated on July 23, 2022

Comments

  • Chase Florell
    Chase Florell almost 2 years

    I use two different IDE's based on what I'm doing. My primary IDE is Visual Studio, whereby I use Chirpy to mash and minify my code. It works flawlessly and I love it. Problem is that when I'm not on my Windows box, I don't have access to it.

    When not using Visual Studio, I'm usually writing Javascript apps in Webstorm on my Macbook Pro. Here in lies the problem. I haven't found a Webstorm plugin or any other app that I can configure to watch my scripts and mash/minify them.

    How do you Mac users mash/minify your JS and CSS at design time with minimal effort?

  • Peter Ajtai
    Peter Ajtai about 12 years
    The YUI compressor is command line, so you could use that.