Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jquery dependency #9525

Closed
fabiocarneiro opened this issue Aug 26, 2015 · 13 comments
Closed

Jquery dependency #9525

fabiocarneiro opened this issue Aug 26, 2015 · 13 comments

Comments

@fabiocarneiro
Copy link

Do you really think is a good idea to have a asset as dependency of a PHP FRAMEWORK?

Do you really need this bower-asset/jquery thing? Can you explain how it is used by php?

@ricardofiorani
Copy link

I got your point, but yes. Yii comes with various widgets wich are jquery dependants.
But in a near future I think the team are going to separate yii in modules so only the modules that requires jquery will actually depend on it. But for now, will be the way it is.

EDIT: I should really answered "Yes, it is." but it would look as a joke.

@samdark samdark added this to the 2.1.x milestone Aug 26, 2015
@samdark
Copy link
Member

samdark commented Aug 26, 2015

That's already in a list of ides for 2.1.

@fabiocarneiro
Copy link
Author

So release it very fast. Do it today. That's really not acceptable.

If what @ricardofiorani said is true, move all that to some sort of default application. A php framework should never provide or depend on "jquery code".

@samdark
Copy link
Member

samdark commented Aug 26, 2015

You're welcome to provide a pull request to speed things up ;)

@nkovacs
Copy link
Contributor

nkovacs commented Aug 27, 2015

Yii has several core features that require jquery, not just some widgets. For example, View::registerJs with View::POS_READY or View::POS_LOAD requires jquery, so does ActiveForm (client-side and ajax validation), or YiiAsset which inserts an ajax prefilter that automatically adds the csrf token so you don't have to deal with that every time you do an ajax call.
These are useful, for example you don't have to implement validation twice, once in a php framework and once in a javascript framework, since Yii has already implemented it in php and jquery.
So yes, it's very much acceptable.

@samdark
Copy link
Member

samdark commented Aug 27, 2015

Well, it could be improved i.e. all this functionality could be moved to an extension which is required from application template's composer.json. So, for example, one could build REST API or console app w/o having this code around.

It's not a huge thing though since Yii deals well with lazy loading classes so if it's not used in particular app it won't ever be autoloaded. So the issue is more about formal correctness and maybe simplifying core framework by moving clientside part into optional package.

@felixfbecker
Copy link

The whole section in the guide about RESTful services is needless if it is not possible to compoer require yii without installing bower-asset globally and jQuery...

@felixfbecker
Copy link

But in a near future I think the team are going to separate yii in modules so only the modules that requires jquery will actually depend on it

Is there a tracking issue for this? For example, it would be nice if one could use only the ActiveRecord of Yii.

@samdark
Copy link
Member

samdark commented Jan 11, 2016

The requirement of jQuery is just a couple of files which are never touched if you're developing REST service only. Should not be huge issue considering storage sizes nowadays. Still worth fixing, of course.

There's no plan to decouple AR functionality from the core. At least at this stage.

@felixfbecker
Copy link

@samdark The problem is not file size. The problem is that composer fails to install yii if I don't have bower-asset installed globally. Which means I have to explain my project lead that to deploy the REST API, they have to install bower-asset via composer first, so it can download jQuery, so it can install Yii.

@samdark samdark closed this as completed Jan 11, 2016
@samdark samdark reopened this Jan 11, 2016
@samdark
Copy link
Member

samdark commented Jan 11, 2016

Yeah. It's already planned to change it. btw., project lead who's not aware about framework used for the project is kinda weird situation.

@cebe
Copy link
Member

cebe commented Jan 14, 2016

they have to install bower-asset via composer first, so it can download jQuery

there is a workaround btw: #8709 (comment)

@klimov-paul
Copy link
Member

Merged into #8452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants