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
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';
@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" ?
@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).
@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
@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.
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
@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
@gittinOld
Hi,
according to this anwser you should try with "glyphicon-chevron-down".
@jwerner
Hi,
I have release version 1.2.2 that does publish the woff2 fonts ;)
Thanks for your help
thanks
works very well. thanks for this extension
Thanks,
easy to install and works very well.
When we get the Bootswatch4 included version?
thanks for your comment
... and regarding the Bootswatch4 version, I'll try to do it as soon as possible, promise !
:)
please note that the yii2-bootswatch4-asset extension is now available.
Hope it helps...
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.