yii2-assets
Yii2 asset collection of useful JavaScript libraries., (*1)
Below are instructions how to use assets., (*2)
You must include dependencies in your composer.json for all assets (see Assets section) that you want to use.
This is due to prevent loading dependency packages for assets that you don't need., (*3)
Assets:
* Awesome Grid
* BxSlider
* History.js
* Intl.js
* Ionicons
* jQuery.browser
* jQuery Serialize Object
* JavaScript Cookie
* Sly
* Sticky
* Owl Carousel
* Owl Carousel 2 Thumbnails
* Are You Sure?
* Bootstrap Tabdrop
* Autobahn JS
* Seiyria Bootstrap Slider
* Highcharts
* messageformat.js
* Fancybox
* Enhanced Events
* ReactJS
* Single Page Nav
* jQuery Easing
* CoreJS TypeAhead
* jQuery File Upload, (*4)
Install
Either run, (*5)
$ php composer.phar require mg-code/yii2-assets "@dev"
or add, (*6)
"mg-code/yii2-assets": "@dev"
to the require
section of your composer.json
file., (*7)
Install dependencies
See Assets section, there are described what dependencies you need to include for every asset., (*8)
To add those dependencies either run, (*9)
$ php composer.phar require vendorName/packageName "*"
or add, (*10)
"vendorName/packageName": "*"
to the require
section of your composer.json
file., (*11)
Usage
There are two ways how to use assets., (*12)
Either register it in view., (*13)
\mgcode\assets\AwesomeGridAsset::register($this);
Either add it as dependency to your asset, (*14)
namespace app\assets;
use yii\web\AssetBundle;
class MyAsset extends AssetBundle
{
...
public $depends = [
'mgcode\assets\AwesomeGridAsset',
];
}
Replace AwesomeGridAsset with desired asset. (See Assets section), (*15)
Assets
Awesome Grid
Asset:, (*16)
mgcode\assets\AwesomeGridAsset
Dependencies:, (*17)
"bower-asset/awesome-grid": "*"
BxSlider
Assets:, (*18)
mgcode\assets\BxSliderAsset
mgcode\assets\BxSliderPluginAsset
Dependencies:, (*19)
"bower-asset/bxslider-4": "*"
History.js
Asset:, (*20)
mgcode\assets\HistoryJsAsset
Dependencies:, (*21)
"bower-asset/history.js": "*"
Intl.js
Main asset:, (*22)
mgcode\assets\IntlJsAsset
Locale Asset:, (*23)
mgcode\assets\IntlJsLocaleAsset
By default IntlJsLocaleAsset
uses locale defined in Formatter configuration.
If you want to override it you can define it in application params
section:, (*24)
return [
..... application configuration ....
'params' => [
'intlJsLocale' => 'en-US',
...
]
];
Dependencies:, (*25)
"bower-asset/intl": "*"
Ionicons
Asset:, (*26)
mgcode\assets\IoniconsAsset
Dependencies:, (*27)
"bower-asset/ionicons": "*"
jQuery.browser
Asset:, (*28)
mgcode\assets\JqueryBrowserAsset
Dependencies:, (*29)
"bower-asset/jquery.browser": "*"
jQuery Serialize Object
Asset:, (*30)
mgcode\assets\JquerySerializeObjectAsset
Dependencies:, (*31)
"bower-asset/jquery-serialize-object": "~2"
JavaScript Cookie
Asset:, (*32)
mgcode\assets\JsCookieAsset
Dependencies:, (*33)
"bower-asset/js-cookie": "~2"
Sly
Asset:, (*34)
mgcode\assets\SlyAsset
Dependencies:, (*35)
"bower-asset/sly": "*"
Sticky
Asset:, (*36)
mgcode\assets\StickyAsset
Dependencies:, (*37)
"bower-asset/sticky": "*"
Owl Carousel
Asset for JS && CSS files:, (*38)
mgcode\assets\OwlCarouselAsset
Asset for JS file:, (*39)
mgcode\assets\OwlCarouselScriptAsset
Dependencies:, (*40)
"bower-asset/owl.carousel": "*"
Owl Carousel 2 Thumbnails
Asset for JS && CSS files:, (*41)
mgcode\assets\OwlCarouselThumbsAsset
Dependencies:, (*42)
"bower-asset/owl.carousel2.thumbs": "*"
Are You Sure?
Asset:, (*43)
mgcode\assets\AreYouSureAsset
Dependencies:, (*44)
"bower-asset/jquery.are-you-sure": "*"
Bootstrap Tabdrop
Asset:, (*45)
mgcode\assets\BootstrapTabdropAsset
Autobahn JS
0.8.2 is the last version of Autobahn|JS that supports version 1 of WAMP., (*46)
Please read documentation here: http://autobahn.ws/js/reference_wampv1.html, (*47)
Asset:, (*48)
mgcode\assets\AutobahnJsAsset
Seiyria Bootstrap Slider
Asset:, (*49)
mgcode\assets\SeiyriaBootstrapSliderAsset
Dependencies:, (*50)
"bower-asset/seiyria-bootstrap-slider": "9.*"
Highcharts
Asset:, (*51)
mgcode\assets\HighchartsAsset
Dependencies:, (*52)
"bower-asset/highcharts-release": "*"
Asset:, (*53)
mgcode\assets\MessageFormatAsset
Dependencies:, (*54)
"bower-asset/messageformat": "*"
Fancybox
Asset:, (*55)
mgcode\assets\FancyboxAsset
Dependencies:, (*56)
"bower-asset/fancybox": "*"
Enhanced Events
Adds document scrollEnd event.
Asset:, (*57)
mgcode\assets\EnhancedEventsAsset
ReactJS
Asset:, (*58)
mgcode\assets\ReactAsset
mgcode\assets\ReactDomAsset
Dependencies:, (*59)
"bower-asset/react": "*"
Single Page Nav
Version 1.2.1 supported., (*60)
Asset:, (*61)
mgcode\assets\SinglePageNavAsset
jQuery Easing
Asset:, (*62)
mgcode\assets\JqueryEasingAsset
Dependencies:, (*63)
"bower-asset/jquery-easing-original": "*"
CoreJs TypeAhead
Asset:, (*64)
mgcode\assets\CoreJsTypeAheadAsset
Dependencies:, (*65)
"bower-asset/corejs-typeahead": "*"
jQuery File Upload
Asset:, (*66)
mgcode\assets\JqueryFileUploadAsset
Dependencies:, (*67)
"bower-asset/blueimp-file-upload": "*"