Oct 15 2013

One-Stop Shop: PHP-Tool Munee Cares for All your Website’s Assets

Advertisement

Cody Lundquist, Australian with a Swedish sounding name, created a free asset-management based on PHP 5.3. Its feature-set is astounding, yet demands a special preliminary treatment of the websites, it’s supposed to be working on. Munee is able to manage any kind of possible asset, be it images or other files, JavaScript, CSS, LESS, SCSS or even CoffeeScript.

munee

Munee’s Heart is its Caching

Munee is enabled to process a row of SEO-related tasks. If you want it to, it will combine all your JS- and CSS-files into one, minify and gzip them. Munee can also work with plain LESS and SCSS without compilation, which it will process at run-time. The same treatment happens to CoffeeScript, which will be translated to JavaScript at run-time.

All files are cached client- as well as server-side. On demand, Munee will check the up-to-dateness of the cache. New versions will only be created if Munee detects more recent changes than the local caches reflect.

In regard to images, Munee offers even more flexibility. It is possible to scale pictures using different criteria and cache them for later use. Besides scaling it is even possible to invoke several of the most popular effect-filters on any given image. If you are still building your online presence and have no pictures available yet, Munee has you covered with its integration of several placeholder-services.

Munee: How it Works

Once installed and with the correct rewrite-rule added, Munee is available server-wide. Its functionality is invoked using several parameters. If you’d want Munee to process a SCSS, output the CSS and minify it, you’d use the following parameter:

<link rel="stylesheet" href="/css/site.scss?minify=true"/>

Parameters can be combined, as this example of a scaled down and filtered image shows:

<img src="/path/to/image.jpg?resize=width[100]height[100]exact[true]&grayscale=true"/>

Combining several CSS-files or LESS/SCSS or mixes even, is achieved, adding all files into one single stylesheet-value like this:

<link rel="stylesheet" href="/css/libs/bootstrap.min.css,/css/site.less"/>

The same is true for JavaScript and CoffeeScript.

As I already mentioned, it is absolutely commendable to use Munee per rewrite via .htaccess. If you don’t want it that way or are not able to set the preconditions, you can as well add Munee to any given function-call. This could look like so:

<link rel="stylesheet" href="/pfad/zu/munee.php?files=/css/libs/bootstrap.min.css,/css/site.css&minify=true"/>

Munee is freely available under MIT license and can be downloaded from Github. The MIT license allows for commercial use.

Munee: the Target

So far, so good. Lundquist’s PHP tool comes equipped with a nice feature-set. Yet, it is not without alternatives.

Let’s start with CSS and JavaScript. It’s true, Munee takes CSS, LESS and SCSS, combines the files, compiles if needed and minifies, all at run-time. Sounds nice. Yet, how often do we really change our CSS and what prevents us from compiling LESS and SCSS before we put it online? We can as well take the files, combine them into one and call one of the many minifiers upon it.

The same is true for JavaScript and CoffeeScript. Why not compile CoffeeScript to JavaScript manually and only put the JavaScript on the server?

The typical small to average website will not see regular or even frequent changes to these files. This usually is job done once or twice a year, at most. Of course, Munee promises to cache server-side and only deliver the cache while nothing changes. This will result in a one-time compilation in most cases, too. Yet, by instinct, I would always prefer the manual method in my own smaller projects.

Speaking of resizing, mainly in responsive designs, there are several better, standards-compliant alternatives. In this field, Munee is no recommendation, simply due to the fact, that it is not able to work fully responsive. In this regard, I see no advantages in the usage of Munee, besides the caching..

Now what’s left? There are use-cases for Munee. I personally operate one. It is a bigger website with five different sections, maintained by five different designers and developers who don’t even know each other.

In this case, an automated accumulation of all the latest efforts via Munee would save a lot of work. Without Munee someone would need to keep track of all changes and care for manually updating the central files. Munee would simply detect the need for changes and process them without anyone even having to think nor communicate about it.

What are your thoughts? Would you try and give Munee a chance in one of your projects?

Related Links

About the Author

Dieter Petereit is Noupe's Editor-In-Chief and a veteran of the web with over 25 years of experience in the world of IT. As soon as Netscape became available he started to do what already at that time was called webdesign and has carried on ever since. Almost a decade ago he started writing for several online publications, some well, some lesser known. Dieter is a heavy G-Plusser, so why not meet him over there?

Homepage

Comments and Discussions
  • Cody, 20 October 2013

    Hi Again Dieter,

    Thanks for reposting your article, this time in English :). I got a lot of traffic to my site and a lot more users of my library :).

    With regards to the section talking about how people only update their CSS/JS once or twice a year on a small site; while that is true, Munee is more for the developing cycle of that site. When people want to take advantage of using LESS or SCSS and don’t want to have to recompile every single time they make a small change. That’s where the main advantage of the “On-The-Fly Compilation” in Munee lies.

    And also what you mentioned about the resizing of images and it not being very useful for responsive websites, I’ve written up a short tutorial on how you can use Munee with a JavaScript Library called Picturefill. Picturefill allows you to use media queries and specify multiple image sizes for different screen widths. Have a look at the article: http://tech.pro/tutorial/1642/adaptive-images-with-munee-and-picturefill

    Thanks again!

    Cheers,
    cody

    • Dieter Petereit, 21 October 2013

      Great that it works out for you.

      I put an example of perfectly sensible on-the-fly-compilation into the article as well. So I wouldn’t say manual compilation is the royal road ;-)

Leave a Reply

Comments are moderated - and rel="nofollow" is in use. Please no link dropping, no keywords or domains as names; do not spam, and do not advertise!

comments form
search form
 
image description image description