xinyeweb/yii2-highlight

yii2-highlight

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:CSS

Type:yii2-extension

dev-master 2019-06-27 02:29 UTC

This package is auto-updated.

Last update: 2024-10-27 14:36:45 UTC


README

yii2-highlight

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist xinyeweb/yii2-highlight "*"

or add

"xinyeweb/yii2-highlight": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

xinyeweb\highlight\HighlightAsset::register($this);

You can override style in your config file, e.g. config/web.php:

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'xinyeweb\highlight\HighlightAsset' => [
                    'css' => ['styles/zenburn.css'],
                ],
            ]
        ],
        ...
    ],

Example of custom cofiguraton of selector or options properties

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'xinyeweb\highlight\HighlightAsset' => [
                    'selector' => '.is-highlighted',
                    'options' => [
                        'classPrefix' => 'custom-',
                        'useBR' => true,
                    ],
                    'css' => ['styles/zenburn.css'],
                ],
            ]
        ],
        ...
    ],

Using of custom build, located in /js/highlight, for example

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'xinyeweb\highlight\HighlightAsset' => [
                    'sourcePath' => null,
                    'css' => ['/js/highlight/styles/zenburn.css'],
                    'js' => ['/js/highlight/highlight.pack.js'],
                ],
            ]
        ],
        ...
    ],