yii2-gentelella icon indicating copy to clipboard operation
yii2-gentelella copied to clipboard

minimal installation

Open mtangoo opened this issue 7 years ago • 14 comments

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

mtangoo avatar Apr 17 '17 19:04 mtangoo

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 avatar May 12 '17 11:05 fps01

@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:

  1. install extension
  2. check files in extension folder

mtangoo avatar May 12 '17 14:05 mtangoo

Oh , yeah ... i have check it the location is @webroot/vendor/bower/gentelella/vendors ... there is about 93MB

nelsonpoon avatar Jun 19 '17 03:06 nelsonpoon

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.

fps01 avatar Jun 19 '17 07:06 fps01

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 avatar Jun 19 '17 10:06 mtangoo

@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 avatar Jun 19 '17 10:06 fps01

@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)

nelsonpoon avatar Jun 19 '17 17:06 nelsonpoon

@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 avatar Jun 19 '17 18:06 mtangoo

@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 avatar Jun 20 '17 03:06 fps01

@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

mtangoo avatar Jun 20 '17 07:06 mtangoo

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 avatar Jun 20 '17 07:06 mtangoo

@mtangoo An automatic copying can produce collisions between different versions of extensions. For example,

  1. we have a working yii2-gentelella package (ver. 1.a.b) with gentelella package (ver. 1.x.y)
  2. the gentelella is updated (ver 1.x.y+1 or ver 1.x+1.0) and this version has a functional with critical changes
  3. the yii2-gentelella downloads new version and it breaks down some functional

Also we can create an issue at gentelella repository to remove vendor directory. I think it's a prefer way to minify size)

fps01 avatar Jun 20 '17 08:06 fps01

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 avatar Jun 20 '17 08:06 mtangoo

@mtangoo , @nelsonpoon Work in progress (https://github.com/puikinsh/gentelella/issues/348)

fps01 avatar Jul 12 '17 03:07 fps01