tempo/jsconfiguration-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A pretty nice way to expose your configuration to your JavaScript.

Installs: 207

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 0

Type:symfony-bundle

0.5 2016-06-02 20:23 UTC

This package is auto-updated.

Last update: 2023-12-04 14:34:49 UTC


README

This bundle allows you to expose configuration in your JavaScript code.

Installation

Require tempo/jsconfiguration-bundle into your composer.json file:

{
    "require": {
        "tempo-project/jsconfiguration-bundle": "dev-master"
    }
}

Register the bundle in app/AppKernel.php:

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Tempo\Bundle\JsConfigurationBundle\TempoJsConfigurationBundle(),
    );
}

Publish assets:

$ php app/console tempo:js-configuration:dump
$ php app/console assets:install --symlink web

Usage

Moreover, you can configure a list of configuration to expose in app/config/config.yml:

# app/config/config.yml

tempo_js_configuration:
  config_to_expose: [mopa_bootstrap.form.show_legend]

Add these two lines in your layout:

<script src="{{ asset('bundles/tempojsconfiguration/js/configuration.js') }}"></script>
<script src="{{ asset('js/tempo_configuration.js') }}"></script>

Testing

Setup the test suite using Composer:

$ composer install --dev

Run it using PHPUnit:

$ phpunit

Resources