Open mtangoo opened 7 years ago
Hello @mtangoo ! yii2-gentelella requires only nesessary packages for layout displaying. For example, original Gentelella theme has many charts. We don't include it. The extension uses a Yii jquery bundle and doesn't download any another. Please describe an issue more informative.
@fps01 That is what I expected. However looking at the vendor directory after installation there are all those files am talking about. The issue is easy to reproduce:
Oh , yeah ... i have check it the location is @webroot/vendor/bower/gentelella/vendors ... there is about 93MB
So it's a structure of a theme repository. I know that a bigger part of it does not used but I do not see a pretty solution. @nelsonpoon , @mtangoo Can you suggest solution?
P.S. A way with a fork of the theme repository is bad idea.
The first thing that came in my mind is don't install any of bower packages. Yii2 already provides JQuery, bootstrap and Jquery UI. You can provide a bower package which user can use to install packages (after editing out what he need). Only core bundles that are essential should be included by default.
I would split asset class into two, Basic and Advanced. The basic one will have core stuffs and advanced will extend core with extras (which user will have to download somehow).
TL;DR - Install core assets and let user extend asset bundle and add whatever extra asset he wants
@mtangoo The repository that's used as theme already contains installed bower packages. I can't download all directories excluding a vendor. Or didn't I understand you?
@fps01 @mtangoo I am a newber of yii2 and yii2 extension , I have no idea to how to remove the JQuery from Yii2-gentelella ,but i think the following packages might be removed that was exists 1.1M jquery (@webroot/vendor/bower/jquery/) 1.1M jquery.inputmask (@webroot/vendor/bower/jquery.inputmask/) 1.3M font-awesome (@webroot/vendor/fortawesome/font-awesome) 2.5M bootstrap (@webroot/vendor/yiisoft/yii2-bootstrap)
@fps01 The file installs all those packages see this and that can be avoided by (as far as I see) by removing the bower dependency on composer.json. The Widget seems to depend only on three js files and two css files (reading from asset classes). That can be easily included with widget and updated only when tagging new releases or when some big bug is fixed on original repo. That way we can avoid the problem.
@nelsonpoon do not remove all those (except may be font-awesome which is dependency of this widget). They are Yii core part
@mtangoo this solution will be work. But we have to observe updates of the main reporitory and pull changes by hands. Let's vote (add reaction to this post). Add +1 - remove dependency or -1 - stay as is.
@fps01 it does not have to be manual work, simple PHP callback downloading latest versions can be added to composer for post-install command. see the composer docs on that
Here is a sample command that should not be hard to adopt
{
"scripts": {
"post-install-packaging": [
"php -r \"copy('https://github.com/puikinsh/gentelella/blob/master/src/js/custom.js', '@vendor/.../js/custom.js');\""
]
}
}
@mtangoo An automatic copying can produce collisions between different versions of extensions. For example,
Also we can create an issue at gentelella repository to remove vendor directory. I think it's a prefer way to minify size)
In that case the script have to download the release package (version will be locked in there per each release), extract the zip and copy necessary files and then delete the folder. That way we can avoid all those issues and few KBs is better than 90+MB (as those others will be deleted)
But still the idea of not including verndor and let user download them via bower/npm is better so I second opening an issue there
@mtangoo , @nelsonpoon Work in progress (https://github.com/puikinsh/gentelella/issues/348)
I have found there are a lot of things that are just waste and somone can install what he want (all plotting stuffs et al,) plus duplication of things like Jquery which Yii2 already bundles. I suggest they get removed and instruction on how to add them for anyone in need will be handy.
I wanted to make pull request but unfortunately have not found time to do so