定制 ischenko/yii2-jsloader 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ischenko/yii2-jsloader

Composer 安装命令:

composer require ischenko/yii2-jsloader

包简介

An Yii2 extension designed to handle JS files, code and asset bundles via various js loaders

README 文档

README

Latest Stable Version Total Downloads Build Status Code Climate Test Coverage License

An extension provides behavior which allows to process js files, code and asset bundles by various js loaders such as RequireJS.

Along with behavior it provides a set of interfaces and base classes for implementing a js loader.

Currently available implementations of js loaders are:

Installation

*Requires PHP >= 7.1

The preferred way to install this extension is through composer.

Either run

composer require ischenko/yii2-jsloader

or add

"ischenko/yii2-jsloader": "*"

to the require section of your composer.json.

Usage

Add the behavior and concrete loader implementation to a view configuration

    ...
    'components' => [
        ...
        'view' => [
            'as jsLoader' => [
                'class' => 'ischenko\yii2\jsloader\Behavior',
                'loader' => [
                    'class' => 'loader\namespace\LoaderClass'
                ]
            ]
        ]
        ...
    ]
    ...

By default the loader skips scripts and bundles/files located in the head section, but if you need to include those scripts or exclude another section(s) you can do this via ignorePositions property:

    ...
    'components' => [
        ...
        'view' => [
            'as jsLoader' => [
                'class' => 'ischenko\yii2\jsloader\Behavior',
                'loader' => [
                    'class' => 'loader\namespace\LoaderClass',
                    'ignorePositions' => [
                        View::POS_HEAD,
                        View::POS_BEGIN
                    ]
                ]
            ]
        ]
        ...
    ]
    ...

Additionally you can set a list of an asset bundles that should be ignored by the loader via ignoreBundles property:

    ...
    'components' => [
        ...
        'view' => [
            'as jsLoader' => [
                'class' => 'ischenko\yii2\jsloader\Behavior',
                'loader' => [
                    'class' => 'loader\namespace\LoaderClass',
                    'ignoreBundles' => [
                        'app\assets\AppCssAsset'
                    ]
                ]
            ]
        ]
        ...
    ]
    ...

统计信息

  • 总下载量: 1.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固