PHPackages                             simplercode/asset-aliases - 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. simplercode/asset-aliases

ActiveLibrary

simplercode/asset-aliases
=========================

AssetAliases is ZF2 module for aliasing paths of JS and CSS assets

65082[2 issues](https://github.com/emcode/AssetAliases/issues)PHP

Since Oct 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/emcode/AssetAliases)[ Packagist](https://packagist.org/packages/simplercode/asset-aliases)[ RSS](/packages/simplercode-asset-aliases/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AssetAliases
============

[](#assetaliases)

Version 0.0.1

Introduction
------------

[](#introduction)

AssetAliases is a ZF2 module that lets you configure aliases for your CSS and JS files and then use them in your view templates instead of hard coding paths. You can use configured aliases with headLink, headScript and inlineScript view helpers as usual.

It can be useful in situation where you have few different ZF2 modules that depend on the same asset files.

Now you can have all paths configured in one place. You can also take advantange from overriding configuration using global and local configuration files.

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

[](#installation)

If you are using composer you can install it by adding line to your composer.json

```
"simplercode/asset-aliases": "dev-master@dev"

```

Usage
-----

[](#usage)

1. Enable AssetAliases module in your application.config.php
2. In any module config or autoloaded config you can configure aliases to assets paths, for ex:

    ```
    array(
        'asset_aliases' => array(
            'scripts' => array(
                'jquery' => '/assets/storage/vendor/jquery/jquery-2.0.3.min.js',
                'modernizr' => '/assets/storage/vendor/modernizr/modernizr.js',
                'select2' => '/assets/storage/vendor/select2/select2.js',
                'bootstrap' => '/assets/storage/vendor/bootstrap/js/bootstrap.min.js',
                'bootstrap-editable' => '/assets/storage/vendor/bootstrap-editable/js/bootstrap-editable.js'
            ),
            'styles' => array(
                'bootstrap' => '/assets/storage/vendor/bootstrap/css/bootstrap.min.css',
                'bootstrap-editable' => '/assets/storage/vendor/bootstrap-editable/css/bootstrap-editable.css'
            )
        ),
    );
    ```
3. Next you can use configured aliases somewhere in your template or partial:

    ```
