Code Monkey home page Code Monkey logo

yii2-jquery's Introduction

ย 

jQuery Extension for Yii 2


jQuery Asset Bundle extension with fixed and CDN sources for Yii2 framework

Latest Stable Version Latest Unstable Version License

This is the jQuery extension for Yii framework 2.0. It provides fixed and CDN jQuery distribution assets and thus makes using jQuery in Yii applications extremely easy.

FEATURES

  • No Bower, Composer installation only

  • CDN & fixed assets source provided

  • Version Controll refers to jQuery


INSTALLATION

The preferred install way is through Composer:

composer require yidas/yii2-jquery

Version options refered jQuery release:

composer require yidas/yii2-jquery ~2.0.0
composer require yidas/yii2-jquery ~3.0.0

Or you could edit composer.json with adding package in require section then run composer update.

"yidas/yii2-jquery": "*"

CONFIGURATION

Register or depend Asset into your application:

yidas\yii\jquery\JqueryAsset

For example, to register jQuery assets in view :

\yidas\yii\jquery\JqueryAsset::register($this);

Or as dependency in your app asset bundle :

namespace app\assets;
use yii\web\AssetBundle;
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/site.css',
    ];
    public $js = [
    ];
    public $depends = [
        'yidas\yii\jquery\JqueryAsset'
    ];
}

Version Control

This extension includes fixed distribution assets for choosing existing version of jQuery, set the version by configuring config file:

'components' => [
    'assetManager' => [
        'bundles' => [
            'yidas\yii\jquery\JqueryAsset' => [
                'version' => '2.2.4',
            ],
        ],
    ],
],

CDN Asset Mode

You could switch Asset to use CDN distribution by configuring config file:

'components' => [
    'assetManager' => [
        'bundles' => [
            'yidas\yii\jquery\JqueryAsset' => [
                'cdnVersion' => '2.2.4',
                'cdn' => true,
            ],
        ],
    ],
],

Specify a CDN source

You could also specify CDN source you like:

'components' => [
    'assetManager' => [
        'bundles' => [
            'yidas\yii\jquery\JqueryAsset' => [
                'cdn' => true,
                'cdnJS' => ['https://code.jquery.com/jquery-2.2.4.min.js'],
            ],
        ],
    ],

],

yii2-jquery's People

Contributors

yidas avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

clement-a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.