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

Precompilation of so many dependencies takes too long

Open mariusz-blaszczak opened this issue 7 years ago • 2 comments

Hi, There is a lot of not always needed assets in the gem, like dozens of language packs. I know that they are dependencies of gentelella. But I am thinking if it would be possible to config it to use only some of them if not needed. Maybe in the rails initializer? I can contribute if you have no time. But I am not sure which approach should I take.

mariusz-blaszczak avatar Sep 05 '17 11:09 mariusz-blaszczak

@blaszczakphoto you're absolutely right, there are indeed tons of dependencies currently imported into the gem and thus the Rails project that are not needed.

I unfortunately am working under a lot of deadlines at the moment, so cannot tackle this myself. However, I believe there's a relatively simple approach to separating the core requirements from the extraneous and it would be very similar to how https://github.com/jquery-ui-rails/jquery-ui-rails does it.

In a nutshell, jquery-ui-rails let's you import everything with one line:

 *= require jquery-ui

That's essentially what gentelella-rails' current require does.

To start breaking it apart, we need to take inspiration from the jquery-ui-rails project and simply introduce a core js and css that loads the core components necessary for our base functionality and then each individual asset we want to load separately. A corresponding example from jquery-ui-rails:

//= require jquery-ui/core
//= require jquery-ui/widget
//= require jquery-ui/position
//= require jquery-ui/widgets/datepicker

In this project's case, sometimes we're just making it possible to one individual library, sometimes a collection of libraries that work together. The important thing, though is to name the components well and add some info about how to pull into a fresh rails project in a piece-meal fashion.

I would also think that introducing sub-directories where it makes sense for some classes of functionalities, like the various different charts, for example.

So that's the quick 10,000 foot overview of my thoughts on the matter. If you want to help make this happen, then I'll definitely try to support you along the way. If you get started, then just think about the specific use-case you're trying to solve. Figure out what goes in the core and what goes into the includes you most need for your own project. It is fine to leave the other components out and unfinished by your own effort so that you're not overwhelmed with feeling burdened to do a "project complete" effort.

mwlang avatar Sep 05 '17 13:09 mwlang

Thanks for the quick and comprehensive answer. At the moment I decided to compile all dependencies into single file and that speed up compiling assets 5 times.

I will stay with that for now, but surely I will come back to that issue soon. When I will know more about the project and performance

mariusz-blaszczak avatar Sep 06 '17 08:09 mariusz-blaszczak