Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DorsetDigital committed May 22, 2018
1 parent 2dcb5c0 commit aa3d3b2
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# silverstripe-cdnrewrite
# Silverstripe CDN Rewrite

Provides a simple method of rewriting the URLs of assets and resources to allow the use of a subdomain or external CDN service


# Requirements
*Silverstripe 4.x

# Installation
* Install the code with `composer require dorsetdigital/silverstripe-cdnrewrite`
* Run a `dev/build?flush` to update your project

# Usage

The module won't make any changes to your site unless you do a bit of configuration. There are a few options to set, done in a yml file:


```yaml
---
Name: cdnconfig
---

DorsetDigital\CDNRewrite\CDNMiddleware:
cdn_rewrite: true
cdn_domain: 'https://cdn.example.com'
rewrite_assets: true
rewrite_resources: true
add_debug_headers: true
enable_in_dev: true
```
The options are hopefully fairly self explanatory:
* `cdn_rewrite` - globally enables and disables the module (default false - disabled)
* `cdn_domain` - the full domain name of the CDN (required to enable module)
* `rewrite_assets` - whether to rewrite references to the 'assets' directory (default false)
* `rewrite_resources` - whether to rewrite references to the 'resources' directory (default false)
* `add_debug_headers` - if enabled, adds extra HTML headers to show the various operations being applied (default false)
* `enable_in_dev` - enable the CDN in dev mode (default false)


# Credits
* Very much inspired by [Werner Krauss' silverstripe-cdnrewrite](https://github.com/wernerkrauss/silverstripe-cdnrewrite)
* As always, thanks to the core team for all their hard work.

0 comments on commit aa3d3b2

Please sign in to comment.