Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large staticfiles directory #7

Open
PetrDlouhy opened this issue Dec 14, 2021 · 7 comments
Open

Large staticfiles directory #7

PetrDlouhy opened this issue Dec 14, 2021 · 7 comments

Comments

@PetrDlouhy
Copy link
Collaborator

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?

@Aleksi44
Copy link
Owner

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

@PetrDlouhy
Copy link
Collaborator Author

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

@Aleksi44
Copy link
Owner

Aleksi44 commented Dec 16, 2021

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

@PetrDlouhy
Copy link
Collaborator Author

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.

@Aleksi44
Copy link
Owner

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

@PetrDlouhy
Copy link
Collaborator Author

@Aleksi44 Thank you very much.

@PetrDlouhy
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants