If SilverStripe doesn't have permissions on your server to write these files it will default back to including them
@@ -122,26 +131,29 @@ individually. SilverStripe **will not** rewrite your paths within the file.
You can also combine CSS files into a media-specific stylesheets as you would with the `Requirements::css` call - use
the third paramter of the `combine_files` function:
- :::php
- $printStylesheets = array(
- "$themeDir/css/print_HomePage.css",
- "$themeDir/css/print_Page.css",
- );
+```php
+$printStylesheets = array(
+ "$themeDir/css/print_HomePage.css",
+ "$themeDir/css/print_Page.css",
+);
- Requirements::combine_files('print.css', $printStylesheets, 'print');
+Requirements::combine_files('print.css', $printStylesheets, 'print');
+```
By default, all requirements files are flushed (deleted) when ?flush querystring parameter is set.
This can be disabled by setting the `Requirements.disable_flush_combined` config to `true`.
## Clearing assets
- :::php
- Requirements::clear();
+```php
+Requirements::clear();
+```
Clears all defined requirements. You can also clear specific requirements.
- :::php
- Requirements::clear(THIRDPARTY_DIR.'/prototype.js');
+```php
+Requirements::clear(THIRDPARTY_DIR.'/prototype.js');
+```
Depending on where you call this command, a Requirement might be *re-included* afterwards.
@@ -156,8 +168,9 @@ included requirements, and ones included after the `block()` call.
One common example is to block the core `jquery.js` added by various form fields and core controllers, and use a newer
version in a custom location. This assumes you have tested your application with the newer version.
- :::php
- Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
+```php
+Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
+```
The CMS also uses the `Requirements` system, and its operation can be affected by `block()` calls. Avoid this by
@@ -179,8 +192,9 @@ careful when messing with the order of requirements.
By default, SilverStripe includes all Javascript files at the bottom of the page body, unless there's another script
already loaded, then, it's inserted before the first `