PHPackages                             josephj/assetla - 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. [Templating &amp; Views](/categories/templating)
4. /
5. josephj/assetla

ActiveLibrary[Templating &amp; Views](/categories/templating)

josephj/assetla
===============

A wrapper of Assetic

37[3 issues](https://github.com/josephj/assetla/issues)PHP

Since Dec 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/josephj/assetla)[ Packagist](https://packagist.org/packages/josephj/assetla)[ RSS](/packages/josephj-assetla/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Assetla
=======

[](#assetla)

A wrapper for Assetic.

[![Code Climate](https://camo.githubusercontent.com/6385870e0972e9d85ad7d493d5de0548722e78a667877574a7d581e6ea07bc09/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a6f736570686a2f61737365746c612e706e67)](https://codeclimate.com/github/josephj/assetla)[![Travis CI](https://camo.githubusercontent.com/11e16e6a86986670bcce9110f7044444ba674fae890db561d90fdadfff47dc30/68747470733a2f2f7472617669732d63692e6f72672f6a6f736570686a2f61737365746c612e737667)](https://travis-ci.org/josephj/assetla)

Configuration File
------------------

[](#configuration-file)

Make modules for your CSS and JavaScript files. These files can be \*.css, \*.sass, \*.coffee, and \*.js.

```
array(
    'output_path' => 'assets',
    'modules' => array(
        'admin_core' => array(
            'css' => array(
                'media/css/admin/reset.css',
                'media/css/admin/text.css',
                'media/css/admin/fluid.css',
                'media/css/admin/core/button.scss', // SCSS
            ),
            'js' => array(
                'media/js/admin/jquery-1.8.1.min.js',
                'media/js/admin/jquery.mousewheel-min.js',
                'media/js/admin/event.coffee', // COFFEE
            ),
        ),
    ),
);
```

## Usage

### General Usage

```php

```

It will output the following HTML.

```html

```

### Concatenate

Or you can concatenate to single file for less requests.

```php

```

It will output the following HTML.

```html

```

### For Precompiliation

Execute the following command.

```
vendor/assetla/bin/assetla precompile config.php
```

It will do minification, concatenation, and overwriting the configuration tasks.

```php
array(
    'modules' => array(
        'admin_core' => array(
            'css' => 'media/css/admin_core_31a85b.min.css',
            'js' => 'media/js/admin_core_6f5a8a.min.js'
        ),
    ),
);
```

### For Deployment

Currently it only supports S3. You need to provide some information in `config.php`.

```php
return array(
    'deploy' => array( // For S3 deployment
        'key' => '',
        'secret' => '',
        'acl' => '',
        'bucket' => '',
        'path' => ''
    ),
    // other settings
),
```

Similar to precompilation, but it saves file to S3 instead.

````php
array(
    'modules' => array(
        'admin_core' => array(
            'css' => 'https://.s3.amazonaws.com//admin_core_31a85b.min.css',
            'js' => 'https://.s3.amazonaws.com//admin_core_6f5a8a.min.js'
        ),
    ),
);
```

Installation
------------

[](#installation)

1. Grab the code `git@github.com:josephj/assetla.git`
2. You need to install several different packages from different package management systems. These steps make sure you could get required compilers (ex. SASS, CoffeeScript, and UglifyJS) installed in local directory.
3. `composer install`
4. `bundle install --path vendor/bundler`
5. `npm install .`
6. Create a writable folder for outputing the compiled files.

    ```
    mkdir assets/out
    chmod 777 assets/out

    ```
7. Set config

    ```
    return array(
        'output_path' => 'assets/out',
        'modules' => array(
            'welcome' => array(
                'css' => array(
                    'assets/css/foo.sass',
                ),
                'js' => array(
                    'assets/js/bar.coffee',
                ),
            ),
        ),
    );
    ```
8. Sample PHP view file using Assetla:

    ```
