README

Configuration

parameters:# This setting is required if you are going to use Assetic.assetic.filter_manager.class:Ladela\RequireJSBundle\FilterManagerladela_require_js:# There can be multiple configs, you choose which one to use# when initializing RequireJS inside a template.config1:# This section configures the <script> tag attributes and RequireJS configuration options.javascript:# The value of 'src' attribute.src://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.9/require.min.js# The value of 'data-main' attribute,# if not provided then the attribute will not be added to the <script> tag.data_main:~# RequireJS configuration options,# see http://requirejs.org/docs/api.html#configoptions:baseUrl:~paths:#alias: pathshim:#module:# deps: []# exports: value# This section configures r.js optimizer if you are going to use Assetic.optimizer:# Path to r.js script (also requires node.js to be installed).r_js:r.js# Configuration options for r.js,# see http://requirejs.org/docs/optimization.html#optionsoptions:baseUrl:.# If left empty then paths from 'javascript' options will be used.paths:#alias: path# If left empty then shim from 'javascript' options will be used.shim:#module:# deps: []# exports: value# Another config and so on.config2: ...

Usage

Inside your Twig template:

{{ require_js_init('config1') }}

If you are using Assetic then you may want to use 'r_js' filter to combine the scripts with help of r.js optimizer: