wagtailyoast icon indicating copy to clipboard operation
wagtailyoast copied to clipboard

Large staticfiles directory

Open PetrDlouhy opened this issue 3 years ago • 7 comments

In the static/wagtailyoast/dist directory there are js/css files for all the versions (0.0.1 - 0.0.9). Especially the yoastanalysis0.0.x.js and yoastworker0.0.x.js files are quite large and having them 9x makes the whole directory to be 39 MB large. This slows down the whole collectatic process for my application (I use whitenoise with static files compression) and makes the distribution package unnecessarily huge and slows down the whole deplyment process.

Are the old versions of those libraries really needed?

PetrDlouhy avatar Dec 14 '21 06:12 PetrDlouhy

@PetrDlouhy

If you use for example wagtailyoast==0.0.9, You can delete all yoastanalysis0.0.x.js and yoastworker0.0.x.js files except :

  • yoastanalysis0.0.9.js
  • yoastworker0.0.9.js.

A version of these files is built for each release. They are independent between versions.

Aleksi44 avatar Dec 14 '21 07:12 Aleksi44

@Aleksi44 I already fixed this issue in my project by

class MyStaticFilesConfig(StaticFilesConfig):
    ignore_patterns = [
        "*wagtailyoast/*0.0.1*",
        "*wagtailyoast/*0.0.2*",
        "*wagtailyoast/*0.0.3*",
        "*wagtailyoast/*0.0.4*",
        "*wagtailyoast/*0.0.5*",
        "*wagtailyoast/*0.0.6*",
        "*wagtailyoast/*0.0.7*",
        "*wagtailyoast/*0.0.8*",
    ]

but it seems very ugly and I will have to keep it in mind when updating to next releases. Other users might have unnecessarily large static files in their project.

Is there any reason, why it is needed to have the old versions in current distribution?

PetrDlouhy avatar Dec 15 '21 19:12 PetrDlouhy

@PetrDlouhy

You are not supposed to have all these files. If you delete your STATIC_ROOT folder where everything is collected and you re-run :

python manage.py collectstatic

Do you still have all those files?

I use a new file name for each release to avoid cache problems.

Aleksi44 avatar Dec 16 '21 07:12 Aleksi44

These files are in the PyPI package. If I download the tar.gz from the PyPI download page, those files are part of the package.

PetrDlouhy avatar Dec 20 '21 10:12 PetrDlouhy

@PetrDlouhy

Sorry for this late reply. It seems that these are old files. For the next release, I will remove them, the package will be lighter.

Aleksi44 avatar Apr 19 '22 06:04 Aleksi44

@Aleksi44 Thank you very much.

PetrDlouhy avatar Apr 19 '22 07:04 PetrDlouhy

@Aleksi44 It seems that in version 0.0.10 all those files are still present. Is there any systematic way to fix this issue?

PetrDlouhy avatar Aug 15 '23 15:08 PetrDlouhy