开发者

Rails assets: All-in-one or one per gem?

开发者 https://www.devze.com 2023-03-30 04:57 出处:网络
I did some work on the pakunok which at the beginning sounded like a good idea: Prepackage the common libraries in one gem so those can be easily used with no hassle.

I did some work on the pakunok which at the beginning sounded like a good idea: Prepackage the common libraries in one gem so those can be easily used with no hassle.

But after I added HAML support I started to feel like it does too much.

So I am wondering whether this gem should be split into multiple ones like: jquery-ui, commons, hamljs etc?

The "facts" about having it all in a single gem are:

  • It unifies the access to the assets.
  • Only one gem.
  • Relatively large if don't use much of it.

The "facts" about having it all in separate gems are:

  • All of them do the same job, for different assets.
  • More granular.
  • Small size.

If it is better to "split" the gem, how to do that? gem per library sounds like too many gems. So probably group of gems wou开发者_StackOverflow中文版ld be good, but group based on what then?

Thanks.


The more libraries you add to the gem the less likely it is that anyone will find it relevant to there project. There is a reason you see small successful gems in use because they are easy to maintain and they have a specific focus to the project, by creating a monolithic gem like this one it begins to loose its sense of purpose and may be outdone by gems that have a smaller focus.

0

精彩评论

暂无评论...
验证码 换一张
取 消