Things are still too ugly. I'll copy some CSS and image files I wrote up
after the last chapter. We could put these in the web/ directory - it
is publicly accessible afterall.
But there's a trick I want to show you, so let's copy them to a new Resources/public
directory in EventBundle. Get these files by downloading the code for this screencast
and looking in the resources directory. I already downloaded and copied that
directory into my project for simplicity:
Why put them in a block? I'll show you exactly why in Episode 2, but
basically this will let us include extra CSS files on only one page. The
page-specific CSS file will show up after whatever we have in this block.
There's a secret. When we run php composer.phar install, the assets:install
command is run automatically at the end. But it's not black-magic, there's
just a scripts key in composer.json that tells it to do this and
a few other things.
The uncool part about this is that it runs the command without the --symlink
option. When the directories are copied instead of symlinked, testing CSS
changes is a huge pain.
Edit the bottom of the composer.json script to activate the symlink option:
This is just the plain web path, except for the Twig asset function. This
function doesn't do much, but it will make putting our assets on a CDN really
wrap it with this.
When we refresh, everything still looks the same. BUT, we've laid the foundation
for being able to do things like use SASS and combining everything into 1
file for speed. We talk about Assetic more in Episode 4.