Skip to content

Distributing assets

Harmen Janssen edited this page Aug 22, 2016 · 1 revision

After you've built your CSS, JS and static images, you will have to distribute them if the designated environment is running S3. This is configured in /application/configs/assets.ini

Distribute to a specific environment

$ g cdn distribute --to=staging

The staging parameter above could also be development, production or integration. Be careful to specify the correct environment, otherwise you'll have to roll it back to prevent code vs code conflicts.

Distribute last modified assets (default), or all

By default, only the recently modified assets will be distributed. This will not be enough for the first time distributing. In that case, add the since parameter:

$ g cdn distribute --to=staging --since=forever

Next to forever, you can also specify a date.

Distributing specific assets or folders

If you want to distribute specific assets, you can add it to the command; the string will match all folders or files.

$ g cdn distribute --to=staging block-bg.jpg
$ g cdn distribute --to=staging block

Note: block will match block-bg.jpg, as well as folders called block (including their contents).

Setting CORS headers

Use the following command to allow cross origin requests from the main domain to the CDN.

$ g s3 setCors --e=[ENVIRONMENT]

Rolling back

Roll assets back by checking out the master branch (or the one running on the harmed server), building and distributing again to correct it.

Clone this wiki locally