Developed with love by KnpLabs Hire us for your project!
37

assetic-extra-bundle

by alexandresalome

Asset Directory filter for Assetic

AlexAsseticExtraBundle

.. image:

.. image:: https://travis-ci.org/alexandresalome/assetic-extra-bundle.png?branch=master
:alt: Build status
:target: https://travis-ci.org/alexandresalome/assetic-extra-bundle

Provides an additional filter for Assetic <https://github.com/kriswallsmith/assetic>_:
asset directory.

This filter will process your CSS and copy assets to a directory, usually in web/
folder.

By doing so, you can include CSS images and fonts from external libraries without storing
dependency in a public folder.

Installation

Edit your composer.json and add the following package as a require:

.. code-block:: json

{
    "require": {
        "alexandresalome/assetic-extra-bundle": "dev-master"
    }
}

Edit your app/AppKernel.php and add the bundle to the registerBundles method:

.. code-block:: php

public function registerBundles()
{
    $bundles = array(
       // ...
       new Alex\AsseticExtraBundle\AlexAsseticExtraBundle(),
       // ...

Configuration

Edit your config.yml and add a section alex_assetic_extra:

.. code-block:: yaml

alex_assetic_extra:
    asset_directory:
        enabled: true

        # Indicates where assets should be copied to
        # when processing CSS files.
        path: %kernel.root_dir%/../web/assets

        # Not really clear yet
        target: assets

Or to quickly use it:

.. code-block:: yaml

alex_assetic_extra:
    asset_directory: true

Usage

To use it, use the filter in your {% stylesheets %} template blocks:

.. code-block:: html+jinja

{% stylesheets filter="combine,assetdirectory"
    "@SomeBundle/Resources/assets/form.css"
    "../vendor/path/to/some.js"
%}
    {# ... #}
{% endstylsheets %}

Changelog

v0.1

  • Initial version
The MIT License (MIT)

Copyright (c) 2013 Alexandre Salomé

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

alex_assetic_extra:
asset_directory:
enabled: false
path: %kernel.root_dir%/../web/assets
target: assets