Documentation
- 1 Getting started
- 2 Integrated fundamentals
- 3 Content store
- 4 Blocks
- 5 Multi channel publishing
- 6 Storage
- 7 Themes and templating
- 7.1 Theme implementation
- 7.2 Loading assets with bower
- 7.3 Including assets
- 7.4 Twig template engine
- 7.5 Rendering of images in content
- 8 Solr
- 9 Contributing
- 9 Social media
- 9 Users
7.2 Loading assets with bower
Integrated takes advantage of the SpBowerBundle for loading assets. You can easily add a Bower package to your application.
Installing bower dependencies
Place your bower.json
in the Resources/config/bower directory.
Example MyBundle/Resources/config/bower/bower.json:
1 2 3 4 5 6 7 | { "name": "your-bundle-name", "dependencies": { "jquery": "~1.8.2" } } |
Now run the command app/console sp:bower:install
to install all the necessary dependencies in the asset directory under Resources/public. You need to run the assets:install command to place the assets in de web directory.
A recommendation is to always use an exact version number when loading libraries with Bower. Bower does not use a lock file (like Composer does), so you need to specify the exact version to be sure the correct version is installed on production.
Installing bower dependencies
Add external styleheets
{% integrated_stylesheets
'bundles/app/css/styles.css'
'bundles/app/css/styles2.css' %}
{% endintegrated_stylesheets %}
Prepend javascript
{% integrated_javascripts mode='prepend'
'bundles/app/js/script.js' %}
{% endintegrated_javascripts %}