---
name: "Jifty::Plugin::CompressedCSSandJS"
section: "3pm"
platform: "linux"
package: "libjifty-perl"
version: "1.10518+dfsg-2"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/Jifty::Plugin::CompressedCSSandJS"
---

# Jifty::Plugin::CompressedCSSandJS(3pm)

Compression of CSS and javascript files

## NAME

Jifty::Plugin::CompressedCSSandJS - Compression of CSS and javascript files

## SYNOPSIS

\# In your jifty config.yml under the framework section:

```
  Plugins:
    - CompressedCSSandJS:
        js: 1
        css: 1
        jsmin: /path/to/jsmin
        cdn: 'http://yourcdn.for.static.prefix/'
        skipped_js:
            - complex.js
        generate_early: 1
```

## DESCRIPTION

This plugin provides auto-compilation and on-wire compression of your application's CSS and Javascript. It is enabled by default, unless your `"ConfigFileVersion"` is greater or equal than 2.

It also supports js minifier, you will need to specify the full path. The jsmin can be obtained from \<http://www.crockford.com/javascript/jsmin.html\>.

Note that you will need to use `"ConfigFileVersion"` 2 to be able to configure jsmin feature.

skipped\_js is a list of js that you don't want to compress for some reason.

generate\_early tells the plugin to compress the CSS and JS at process start rather than on the first request.  This can save time, especially if your JS minifier is slow, for the poor sucker who makes the first request.  Enabled by default.

### init

Initializes the compression object. Takes a paramhash containing keys 'css' and 'js' which can be used to disable compression on files of that type.

### js\_enabled

Returns whether JS compression is enabled (which it is by default)

### css\_enabled

Returns whether CSS compression is enabled (which it is by default)

*generate\_css*

Checks if the compressed CSS is generated, and if it isn't, generates and caches it. (In devel mode, it always regenerates it)

*generate\_javascript*

Checks if the compressed JS is generated, and if it isn't, generates and caches it.

*\_generate\_javascript\_nocache*

Generates compressed javascript, ignoring the cache completely.

### minify\_js \\$js

Runs the given JS through jsmin

### wrap

psgi app wrapper to serve url controlled by us
