-
Notifications
You must be signed in to change notification settings - Fork 2
Component
string
An ID of the component, should be unique. A valid name contains [a-z][a-z-0-9]+.
// Example
'font-awesome' => [
// ...
]array
Either
jsorcssor whatever text given will be considered as component section.
// Example
'component-id' => [
// ...
'css' => [
// ...
],
// another section
/*'js' => [
// ...
],*/
]string
URL to the source directory. If a component directory is icons/font-awesome under the cdn directory, you can set the
@srcproperty as icons/font-awesome.
Default is
Cdn'sbasePath+component-id(e.g.,/cdn/component-id)
// Example
'font-awesome' => [
// ...
'@src' => 'icons/font-awesome',
// ...
]string
Base url to the
component. This will overridebaseUrlproperty of Cdn component.
Default is
Cdn'sbaseUrl+component-id(e.g.,/cdn/component-id)
// Example
'component-id' => [
// ...
'@baseUrl' => 'http://domain.com',
// ...
]array Pairs of key=>value.
Define the component attributes.
Default is
[]
// Example
'font-awesome' => [
// ...
'@attributes' => [
'foo' => 'bar',
],
// ...
]/** @var \yii2cdn\Component $comp */
$comp = \Yii::$app->cdn->get('font-awesome');
// Get attribute value
echo $comp->getAttr('attribute');
// output: value
// Update/Set attribute
echo $comp->setAttr('attribute', 'value');
// output: value
// Get all the attributes
print_r ( $comp->getAttributes() );boolean
Use component as offline. Setting
truewill skip the component whenYII2CDN_OFFLINEis set to false.
Default is
false
// Example
'component-id' => [
// ...
'@offline' => true,
// ...
]array
IDs of the sections consider as offline and will be skipped when
YII2CDN_OFFLINEis set to false.
Default is
[]
// Example
'component-id' => [
// ...
'@offlineSections' => ['css', 'js'],
// ...
]Copyright (c) 2016 Junaid Atari and it's contributes.