O'Reilly logo

Web Application Development with Yii 2 and PHP by Jeffrey Winesett, Mark Safronov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The asset bundles

We already mentioned and used asset bundles in brief back in Chapter 3, Automatically Generating the CRUD Code. Let's discuss them in more detail.

The purpose of an asset bundle is to have a group of related CSS and/or JavaScript files lying somewhere in the code base, and to be able to register them in the HTML page with a single PHP call. More than this, asset bundles can depend on other asset bundles, and in this case, a single call to register one top-level "master" asset bundle can result in registering the whole UI for the application. The CSS and JavaScript files are called "assets" here, hence the name of the concept is asset bundle.

An asset bundle with files from an arbitrary folder

The following is a typical asset bundle, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required