Yii 2.0: yii2-bootswatch-asset

Brings Bootswatch to Yii2
11 followers

Ever wanted a nice design based on Bootstrap for your web pages ? .. and of course, with minimal effort ?

Well, yii2-bootswatch-asset is just what you need, an Asset bunlde around the Bootswatch theme suite. Visit Bootswatch for more.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist raoul2000/yii2-bootswatch-asset "*"

or add

"raoul2000/yii2-bootswatch-asset": "*"

to the require section of your composer.json file.

Usage

To use a bootswatch theme in your Yii2 application, add the BootswatchAsset bundle to your main AppAsset bundle:

// ./assets/AppAsset.php
 
class AppAsset extends AssetBundle
{
    public $depends = [
        'yii\web\YiiAsset',
        // let's add the BootswatchAsset here
        'raoul2000\bootswatch\BootswatchAsset',
    ];
}
?>

Then at some point you must select the theme name you want to use. In the example below, the theme 'cosmo' is set in the main layout.

// ./views/layouts/main.php
 
raoul2000\bootswatch\BootswatchAsset::$theme = 'cosmo';
AppAsset::register($this);

For more information on the plugin options, please refer to yii2-bootswatch-asset@github.

Resources

Changes

version 1.2.7

  • update to bootswatch 3.3.7

version 1.2.6

  • update to bootswatch 3.3.6+1

version 1.2.5

  • update dependency : thomaspark/bootswatch version 3.3.5+2. This is to avoid the Failed to decode downloaded font error message (see https://github.com/raoul2000/yii2-bootswatch-asset/issues/5)

version 1.2.4

  • update to bootswatch 3.3.5

version 1.2.3

  • update to bootswatch 3.3.4

version 1.2.2

  • fix : publish woff2 font "glyphicons-halflings-regular.woff2" (thanks to jwerner)

version 1.2.1

  • update dependency : thomaspark/bootswatch version 3.3.2 after bootstrap 3.3.2 has been release

version 1.2.0

  • update dependency : thomaspark/bootswatch version 3.3.1 in order to include latest bootswatch themes (journal, sandstone).

version 1.1.1

-fix : minified CSS was not correctly handled. Now, if YII_ENV_DEV is defined bootstrap.css is published, otherwise bootstrap.min.css is used

version 1.1.0

  • fix : gylphicons not accessible.
  • enh : optimize publication process. When no theme is set, no publication is performed.
  • enh : no theme is selected by default.

version 0.0.0

  • Initial release

Total 10 comments

#19372 report it
nguyendh at 2015/06/05 05:46pm
thanks

works very well. thanks for this extension

#18894 report it
Raoul at 2015/01/31 12:11pm
@jwerner

Hi,

I have release version 1.2.2 that does publish the woff2 fonts ;)

Thanks for your help

#18893 report it
Raoul at 2015/01/31 11:42am
@gittinOld

Hi,

according to this anwser you should try with "glyphicon-chevron-down".

#18877 report it
Raoul at 2015/01/28 05:52am
@jweneer and @gittinold

Hi guys,

@jweneer: Good catch ! ... Thanks, I'll implement your modification and release a new version (soon)

@gittinold: that's strange .. since 1.1.0 glyphicons are published correctly. Can you try to empty your app/web/assets folder so it gets re-published again ?

ciao

#18872 report it
jwerner at 2015/01/27 11:02am
Missing woff2 File in assets Folder

Thanks for this extension!

In the generated assets/.../fonts folder, the file glyphicons-halflings-regular.woff2 is missing.

Adding woff2 to line 54 in the file BootswatchAsset.php seems to fix it:

return in_array($ext,['css','eot','svg','ttf','woff','woff2']);

Maybe also clear the web/assets folder...

Regards, Joachim

#18870 report it
gittinOld at 2015/01/27 12:39am
@Raoul

Hi, I cannot access glyphicons. I changed from '*' to 'dev-master' to '>=1.2.0' to '1.2.0' and finally '1.1.0'.

Could you please tell me how I can reference glyphicons with raoul2000/yii2-bootswatch-asset ?

Thanx in advance.

P.S. I'm referencing them like below:-

[
                    'label' => Yii::$app->user->identity->username,
                    'url' => '#',
                    'template' => '<a href="{url}" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i> {label} <i class="icon-angle-down"></i></a>',
                    'visible' => !Yii::$app->user->isGuest
]

The 'icon-angle-down' works fine. Just not glyphicons.

#18268 report it
Raoul at 2014/10/08 05:01pm
@dastiii

ok I understand now. Thanks for the explanation.

By the way, the version 1.1.0 fixed an issue with the glyphicons that were not correctly published.

ciao

#18255 report it
dastiii at 2014/10/07 06:02pm
@Raoul

Shouldn't be a problem anymore since there is a 1.1.0 version now. Previously there only was a 'dev-master' version.

If you had your minimum stability in your composer.json set to anything else than 'dev' then composer couldn't find a matching version when using an asterisk. That's because it searches for the latest version with a stability that equals at least your 'minimum stability' setting.

In those cases you have to specify an explicit version, thats why I had to change the asterisk to dev-master (minimum stability of my composer.json was beta).

#18246 report it
Raoul at 2014/10/07 03:58am
@dastiii

Hi Dastiii,

I'm not very familiar with composer, so I'm not sure to understand what you mean by "minimum stability".

What is the difference between * and 'dev-master' in terms of "stability" ?

#18233 report it
dastiii at 2014/10/03 05:56am
Minimum stability

Be sure to change the asterisk to dev-master if your minimum stability is set to a higher value.

EDIT:

raoul2000\bootswatch\BootswatchAsset::$theme = 'amelia';

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet