yiisoft / yii2-bootstrap

Yii 2 Bootstrap 3 Extension
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
185 stars 193 forks source link

Upgrade to bootstrap 4 #77

Closed samdark closed 5 years ago

webstylemedia commented 8 years ago

cebe, I know about linking to that dev repository, but if you deploy it on your server and run test page and view source you will see that bootstrap.css and bootstrap.js has version 3.3.6.

I think this dev link in bower is wrong. It download 3.3.6

I used this command in separate project to get 4 alpha: "twbs/bootstrap": "^4.0",

Please try it and see. Your current dev link is loading 3.3.6.

bot4343 commented 8 years ago

I try install Yii2 with Bootstrap4-alpha2:

"require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.5",
        "yiisoft/yii2-bootstrap": "dev-2.1"
}

But got Composer error: The requested package yiisoft/yii2-bootstrap dev-2.1 exists as yiisoft/yii2-bootstrap[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.1.x-dev, dev-master, 2.0.x-dev] but these are rejected by your constraint.

What I'm doing wrong?

rob006 commented 8 years ago

You should use:

"yiisoft/yii2-bootstrap": "2.1.x-dev"
webstylemedia commented 8 years ago

It still not work for me. I tried "yiisoft/yii2-bootstrap": "2.1.x-dev" too but still see Bootstrap v3.3.6 in source files....

It has yii2-bootstrap package files prepared for bootstrap 4 but from bower installed 3.3.6 version of bootstrap itself.

I attached screenshot.

Please help me. screenshot

bot4343 commented 8 years ago

I have the same, 2.1.x-dev = Bootstrap 3.3.6

tbreuss commented 8 years ago

Same problem here. My settings are:

    "minimum-stability": "dev",
    "require": {
        ...
        "yiisoft/yii2-bootstrap": "2.1.x-dev",
        ...
    },

I updated composer and deleted the composer cache. After composer update i have bootstrap 3.3.7.

cebe commented 8 years ago

I have just updated the version constraint and I am able to install bootstrap 4 with the following composer.json:

{
    "require": {
        "yiisoft/yii2": "~2.0.9",
        "yiisoft/yii2-bootstrap": "~2.1.0@dev",
        "bower-asset/bootstrap": "~4.0.0@alpha",
        "bower-asset/jquery": "2.2.*"
    }
}

When not including the bower-asset/bootstrap requirement in my own composer.json however the installation does not work. Not sure what is going on with composer, which seems to apply the minimum stability in depdencies and does not allow overriding it with @alpha.

cebe commented 8 years ago
$ composer show
bower-asset/bootstrap        v4.0.0-alpha.3    The most popular front-end framework for developing responsive, mobile first projects on the web.
bower-asset/jquery           2.2.4             
bower-asset/jquery.inputmask 3.2.7             jquery.inputmask is a jquery plugin which create an input mask.
bower-asset/punycode         v1.3.2            
bower-asset/tether           v1.2.4            A client-side library to make absolutely positioned elements attach to elements in the page efficiently.
bower-asset/yii2-pjax        v2.0.6            
cebe/markdown                1.1.0             A super fast, highly extensible markdown parser for PHP
ezyang/htmlpurifier          v4.8.0            Standards compliant HTML filter written in PHP
yiisoft/yii2                 2.0.9             Yii PHP Framework Version 2
yiisoft/yii2-bootstrap       2.1.x-dev c048258 The Twitter Bootstrap extension for the Yii framework
yiisoft/yii2-composer        2.0.4             The composer plugin for Yii extension installer
cebe commented 8 years ago

okay, here is why the bootstrap package has to be included in the root composer.json when you have minimum stability set to stable: stability flags (@alpha) are root only and are ignored inside dependencies:

require and require-dev additionally support stability flags (root-only). https://getcomposer.org/doc/04-schema.md#package-links

cebe commented 8 years ago

An other way to go would be:

Alternatively, you can combine minimum-stability: dev with prefer-stable: true that will prevent everything from updating to dev versions but only take dev when necessary. https://github.com/composer/composer/issues/4823#issuecomment-174461647

set-st commented 8 years ago

I'm trying move my project from mac to linux machine, and got this error:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package bower-asset/bootstrap ~4.0.0@alpha exists as bower-asset/bootstrap[dev-master] but these are rejected by your constraint.
  Problem 2
    - yiisoft/yii2-bootstrap 2.1.x-dev requires bower-asset/bootstrap ~4.0.0@alpha -> no matching package found.
    - yiisoft/yii2-bootstrap 2.1.x-dev requires bower-asset/bootstrap ~4.0.0@alpha -> no matching package found.
    - Installation request for yiisoft/yii2-bootstrap ~2.1.0@dev -> satisfiable by yiisoft/yii2-bootstrap[2.1.x-dev].

On mac os composer update performs without errors. Any help, please.

    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "~2.0.9",
        "yiisoft/yii2-bootstrap": "~2.1.0@dev",
        "bower-asset/bootstrap": "~4.0.0@alpha",
        "bower-asset/jquery": "2.2.*"
    },
samdark commented 8 years ago

Try

    "minimum-stability": "dev",
craigpotter commented 8 years ago

With BS calling it on v3 (Well not completely but wanting to focus on v4) should we be looking at doing the same for yii2-bootstrap?

cebe commented 8 years ago

as v4 is not even released as stable we will of course continue to support v3.

skotos commented 8 years ago

Just for the mix ... yii\widgets\LinkPager is currently built around BS3 and is placed in the core Yii2 repo. I've written a wrapper class that extends the LinkPager widget with BS4 stuff (maintains the A tag for disabled page buttons and overrides class name variables). As bs4 takes more steam, should such a wrapper class be included in yiisoft/yii2-bootstrap(~2.1.0), or should the LinkPager in yiisoft/yii2 be modified to be more flexible with bootstrap versions?

marnap89 commented 7 years ago

Hi :) Do you have any clue how to upgrade bootstrap to the newest alpha 5 version with composer?

cebe commented 7 years ago

does the version constraint not match that version?

ghost commented 7 years ago

No it does not.

tekord commented 7 years ago

Try composer require twbs/bootstrap:4.0.0-alpha.5 (it is official way from http://v4-alpha.getbootstrap.com/getting-started/download/)

marnap89 commented 7 years ago

@tekord But it is not Yii way :)

tekord commented 7 years ago

@marnap89 it works for me very well. I set "@yii2/bootstrap" alias to my folder where I override classes to use BS4.

marcocianci commented 7 years ago

@tekord and @marnap89 to get latest bootstrap, run from root project folder: $ bower install bootstrap#v4.0.0-alpha.6

skotos commented 7 years ago

Is there a reason for holding tether at 1.2.x? bs4-alpha6 in bower requires at least 1.4.x. If we bump this in composer.json, alpha6 should just pull in. (at least I think that is whats going on.)

cebe commented 7 years ago

@skotos I do not think there is a reason, we are just not closely following bootstrap development to notice that. Could you test it with 1.4.x and send a PR if it works?

Enrica-r commented 7 years ago

I read the discussion about migration bs3 to bs4. I'm really a little bit worried. Boostrap has changed too many things completely so that all extensions and all applications couldn't be changed in one step. One example is Glyphicon. This has been remove in bs4. It's almost everywhere in Yii2 extensions. (BTW here is a temporary solution for this: https://gist.github.com/planetoftheweb/5d75a1ad45eb3059710747a3695fc068)

Probably same could happen with bs4 to bs5 in few years and so on. If a change from one release to another is too hard the longer an old version will be kept in production. I'm afraid that too much of developers will keep 2.0.x caused by bs3. It's not good to have 3 LTS versions to maintain (Yii1.1, Yii2.0, Yii2.1...)

I wish (only wish not a request) that extension developers get time to change from now on and app developers could change page by page in their app. I think best process would be:

I afraid that a hard change for all (extension developers and app developers) at same time will end up in a chaos or 2.0.x will be frozen until all important extensions have prepared a 2.1.x version.

Please think about the migration process. LTS versions of Yii should be caused by have Yii changes only and not by bs changes. Thanks to all. Enrica

Sammaye commented 7 years ago

Glyphicons do get removed from time to time, originally in BS3 they didn't have them. Normally it is a fight between Bootstrap makers and the glyphicon makers for some legal issue or something

dillix commented 7 years ago

Its time to use Fontawesome instead of Glyphicons.

Enrica-r commented 7 years ago

@dillix I fully agree with you. Fontawesome should be used by default. Another posibility is Material Design Icons see https://materialdesignicons.com/. Here you could compare the most important Icon providers: http://tagliala.github.io/vectoriconsroundup/

@Sammaye If the license question isn't fully clarified Glyphicons will be removed.

Generally the icon thing was an example only.

cebe commented 7 years ago

It's not good to have 3 LTS versions to maintain (Yii1.1, Yii2.0, Yii2.1...)

This will be only the extension to maintain, not the whole framework. You can use Yii 2.1 together with bootstrap extension 2.0 if you want to stay with bootstrap 3. Its not hard to maintain a bootstrap extension for bootstrap 3 if bootstrap 3 does not change.

Also I do not think there is a need to upgrade an application that is build on bootstrap 3 to bootstrap 4 as that would imply a rewrite of the CSS styles for the site.

Imo there is no need to think about an upgrade process for a CSS framework if you have a lot of custom code style. If you have mostly original bootstrap rules the upgrade should be easy.

Enrica-r commented 7 years ago

@cebe (Hello, I try to answer in english even if a discussion in German would be easier for me.) I fully agree that the core of the framework isn't touched by this. Even the level BS repo is easy to handle with a parallel version 2.0 and 2.1 from your point of view.

The hundreds of independent developed extensions are the critical point. They combine core, bootstrap. They uses boostrap classes for grids, inputs, buttons etc. actively. Yiisoft has one package coordinated with BS base and your BS extensions. Here is no issue.

A single producer of extensions like Kartik could find his versioning strategy as you did with having two separate development lines.

But think about an app developer using extensions from different vendors. If each vendor has it's own strategy, versions and roadmap it will end up in a mess. So it's not an issue to change own app code from BS3 to BS4 but it's an issue to coordinate the extensions. But an app developer can't change before all his used extension have BS4 version ready.

For me as app developer Yii2 is ONE bundle. Yiisoft could help to do migration from BS3 to BS4 for all his dependent vendors. The core will be untouched anyway but Yii's bootstrap repo could help. If nothing is done on code level then Yiisoft should write a migration documentation with a migration instruction or recommendation for all affected vendors of extensions like:

Thank you very much for engagement.

cebe commented 7 years ago

So it's not an issue to change own app code from BS3 to BS4 but it's an issue to coordinate the extensions.

we can write up some recommendation guidelines for this, so it is easier for extension developers to create something that is consistent.

But an app developer can't change before all his used extension have BS4 version ready.

In most cases there are not many things to change from bootstrap 3 to 4 so if you rely on an extension you can work together with the author to make it compatible with bootstrap 4.

Enrica-r commented 7 years ago

@cebe Thanks for your support, I think you saw the issue. A recommendation is OK. It's not many to do but it's not compatible to each other. Any way if all are aware it will work.

samdark commented 7 years ago

http://blog.getbootstrap.com/2017/08/10/bootstrap-4-beta/

dryu commented 7 years ago

Bootstrap 4 has progressed to Beta now.

mitloshuk commented 7 years ago

Bootstrap 4 autoupdated to Beta from composer, but: composer.json "bower-asset/bootstrap": "~4.0.0@alpha", "yiisoft/yii2-bootstrap": "2.1.x-dev",

When using Bootstrap now Error: Bootstrap dropdown require Popper.js (https://popper.js.org)

For example, Gii frontend not working correctly TypeError: $hint.parent(...).find(...).addClass(...).popover is not a function

dillix commented 7 years ago

@mitloshuk, Bootstrap 4 beta has been migrated from tether.js to popper.js for tooltips, dropdowns & etc.

samdark commented 6 years ago

http://blog.getbootstrap.com/2017/10/19/bootstrap-4-beta-2/

hasanzahran commented 6 years ago

Any update to use bootstrap 4 ?

samdark commented 6 years ago

It's in 2.1 branch for a long time. Will be tagged when v4 will be released.

samdark commented 6 years ago

http://blog.getbootstrap.com/2017/12/28/bootstrap-4-beta-3/

bobonov commented 6 years ago

The release of yii2 bootstrap4 should be done together or after issue yiisoft/yii2#10712 since bootstrap4 has dropped glyphicon

beroso commented 6 years ago

Bootstrap 4 was released today

samdark commented 6 years ago

http://blog.getbootstrap.com/2018/01/18/bootstrap-4/

dillix commented 6 years ago

@bobonov May be we should use fontawesome as drop in replacement for glypicons?

acerix commented 6 years ago

For the glyphicon issue, I suggest using an approach like this which maps them to fontawesome:

https://gist.github.com/blowsie/15f8fe303383e361958bd53ecb7294f9

Here's a demo of that with a basic grid view:

https://codepen.io/acerix/full/Eorazw/

dillix commented 6 years ago

@acerix there is no glyphicons in bootstrap 4 anymore, it was dropped for license issues.

Insolita commented 6 years ago

So, as i see yii2-bootstrap with bootstrap4 coming in 2.1 branch... and this make impossible to use both 3.x and 4.x version in one project (3.x with adminLte for backend and 4.x for frontend) without duct tape

samdark commented 6 years ago

That's valid case...

rob006 commented 6 years ago

This was discussed almost 2 years ago. Using separate extension for Bootstrap 4 may simplify using two different versions of Bootstrap in single project, but it will make upgrade from bootstrap3 to bootstrap4 more difficult (you need to change namespace everywhere) and maintain extensions that depend on bootstrap will become a nightmare (you need to support 2 lines even if the only difference is used yii2-bootstrap extension). There is no perfect choice here.

Insolita commented 6 years ago

Hmm, the decision about change bootstrap version in existed project is more complex, is not just about change yii2-bootstrap version, it can depends on many third-party plugins and requires significant changes on the part of the design layout. The replacing namespaces is not so difficult task in modern IDE. As matter of fact bootstrap-3 based solutions there are very popular for backend-side, and it is enough for most backend cases. But front-side often need to use more modern trends But is only my opinion.