PHPackages                             elefant/app-assetic - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elefant/app-assetic

ActiveElefant-app[Utility &amp; Helpers](/categories/utility)

elefant/app-assetic
===================

Assetic app for the Elefant CMS

1.0(13y ago)639MITPHP

Since Jul 10Pushed 13y ago2 watchersCompare

[ Source](https://github.com/jbroadway/assetic)[ Packagist](https://packagist.org/packages/elefant/app-assetic)[ RSS](/packages/elefant-app-assetic/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

This is an app for the [Elefant CMS](http://github.com/jbroadway/elefant)that pre-compiles and compresses Javascript and CSS using the [Assetic](https://github.com/kriswallsmith/assetic) library.

It also supports compiling the following formats

- [SASS](http://sass-lang.com/) -&gt; CSS (.sass files)
- [LESS](http://lesscss.org/) -&gt; CSS (.less files)
- [CoffeeScript](http://coffeescript.org/) -&gt; Javascript (.cs or .coffee files)
- [Handlebars](http://handlebarsjs.com/) -&gt; Compiled templates

### Installation

[](#installation)

1. Drop this app into your `apps/` folder.
2. Open the file `apps/assetic/conf/config.php` and set the paths to your compressors/compilers of choice (SASS, CoffeeScript, Handlebars, etc).

By default, it will use JSMinPlus for JavaScript compression and CSSMin for CSS compression. Other options include UglifyJS2/UglifyCSS, and YUI Compressor.

### Usage

[](#usage)

To use Assetic on a single script:

```

```

This will output something like:

```

```

Similarly, you can do the same with CSS files:

```

```

Will produce:

```

```

To use Assetic on several scripts or stylesheets at a time:

```

{# assetic/myscripts?js[]=js/jquery.js&js[]=js/jquery.verify_values.js #}

```

This will produce:

```

```

> Note: Change `myscripts` to the name to use to save the cache file as. Otherwise, `all.js` will be used.

File lists can also be written over multiple lines, like this:

```

{# assetic/myscripts
	?js[]=js/jquery.js
	&js[]=js/jquery.verify_values.js #}

```

### Recompiling later

[](#recompiling-later)

To regenerate the scripts, log into Elefant and go to `Tools > Assetic` and click `Recompile Assets`. This will change the modification time on all templates, so that they are regenerated the next time they are run in the browser. The `?v=` number will also regenerate so that browsers will automatically use the latest version at all times.

For development, you can also change the tags to use Elefant's `{! !}` tags instead, which will load the Assetic compilation process anew on each request:

```

```

> It is smart enough to not regenerate the cache if the original files haven't changed, to reduce page load times during development.

### How it works

[](#how-it-works)

The `{# #}` template tag will render the scripts the first time the layout is loaded and hard-code the resulting HTML into the template for subsequent requests, so the handler is only called the first time. This makes this plugin very fast for serving your optimized CSS and Javascript, since after the first load, the compiled scripts are called directly, bypassing the plugin entirely for subsequent requests.

> You can achieve additional optimization by enabling GZIP output in your web server configuration.

### Precompiling Handlebars templates

[](#precompiling-handlebars-templates)

To precompile your Handlebars templates for faster execution on the client-side, which also includes only the much smaller Handlebars runtime without the compiler, follow these steps:

1\. Save your Handlebars templates with a `.handlebars` file extension in your app's views folder. For example:

```

Hello {{name}}
```

2\. Include the following tag in your layout template to precompile them:

```
{! assetic/handlebars !}

```

3\. After the above include has compiled the templates, you can include them via:

```

```

This also includes the Handlebars runtime, minus the compiler, for you.

4\. To call a template, simply refer to it like this:

```

$('#my-div').html (Handlebars.templates.my_template (data));

```

Alternately, you can run the Handlebars compiler from the command line like this:

```
$ cd /path/to/your/website
$ ./elefant assetic/handlebars
```

This replaces step 2 from the above, but note that you'll need to call it again whenever you modify a template, or run it with the `--auto` option to watch for template changes and automatically recompile them:

```
$ cd /path/to/your/website
$ ./elefant assetic/handlebars --auto
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

5054d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b91acdfd63010e0f6e919966f77adb2d8ce178bca89db78645d5d69f44f5aebe?d=identicon)[jbroadway](/maintainers/jbroadway)

---

Top Contributors

[![jbroadway](https://avatars.githubusercontent.com/u/87886?v=4)](https://github.com/jbroadway "jbroadway (31 commits)")

---

Tags

javascriptcsscmsoptimizationasseticappcompileelefant

### Embed Badge

![Health badge](/badges/elefant-app-assetic/health.svg)

```
[![Health](https://phpackages.com/badges/elefant-app-assetic/health.svg)](https://phpackages.com/packages/elefant-app-assetic)
```

###  Alternatives

[doublesecretagency/craft-cpjs

Add custom JavaScript to your Control Panel.

43163.7k](/packages/doublesecretagency-craft-cpjs)[dotsunited/bundlefu

BundleFu is a PHP 5.3+ library which bundles multiple css/javascript files into a big package and sends it out at once

7028.5k3](/packages/dotsunited-bundlefu)[nlac/nlsclientscript

Yii ClientScript extension for prevent reloading javascript and merging/minfying resources

208.2k](/packages/nlac-nlsclientscript)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
