6

I'm trying to install the jquery-ui-dist package, and when I run collectstatic, whitenoise seems to have trouble when a url is inside quotations in a stylesheet.

The error I get is:

MissingFileError: The file 'jquery-ui-dist/"images/ui-icons_555555_256x240.png"' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7fb16b7000b8>.

The CSS file 'jquery-ui-dist/jquery-ui.css' references a file which could not be found:
  jquery-ui-dist/"images/ui-icons_555555_256x240.png"

Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.

I see that it seems to think it's looking for a bad filename, as it keeps the quotations around it, and I assumed that the reason was because the source file has url("images/ui-icons_555555_256x240.png") when the quotations are unnecessary, so I ran sed -i 's/\"images\/ui-icons_555555_256x240.png\"/images\/ui-icons_555555_256x240.png/g' jquery-ui.css on the source file, which removed the quotation marks, but I still get the error.

I'm assuming there is a problem with either whitenoise or the jquery-ui-dist package, but until the problem is fixed on their end, I at least need a temporary solution, and I'm not even sure where the actual problem lies.

EDIT:

I found that it is the comments in the css files that are causing the issue. I don't know why whitenoise is parsing comments though, nor do I know what I can do about it other than manually remove those comments.

PoDuck
  • 1,381
  • 15
  • 38

3 Answers3

10

Since nobody else has information on this, I decided I would answer my own question in case people have this problem and don't read my edit.

If you edit the source files to remove comments, it will fix the problem. The problem with this is, each time you update the source files, it will overwrite the edited files, and you will be stuck removing comments again.

To be honest, I have not checked this recently to see if it is still an issue as of the time of this reply, but I assume it still is.

PoDuck
  • 1,381
  • 15
  • 38
  • Wow, apparently this is a long standing issue. 6 years old. Glad it is being fixed. – PoDuck Jun 12 '19 at 11:01
  • [ask] To solve this issue have I to remove all comment in jquery-ui.css ??? – Riska Kurnianto Feb 24 '20 at 10:11
  • I haven't used whitenoise in a long time, so I don't remember exactly what I did to remove the comments, or how the comments are structured, but it should be a simple matter to make a script to find and remove all comments, which is probably what I did. – PoDuck Feb 25 '20 at 11:56
  • Still broken with Django 2.2.4, Whitenoise 4.1 and jQuery UI 1.12.1. Had to remove comments on top of jquery-ui.min.css to make it work. – LNI Sep 28 '20 at 04:27
1

I just try to remove all first comment block in all jquery css file, and it works well. Thanks.

Riska Kurnianto
  • 111
  • 1
  • 7
0

I also faced this issue.
This issue seems not to be resolved also in django community yet, I think.
Please look at following articles.

Though I am not satisfied with this solution, eventually I put static jquery-ui.min.css file in my repository and not installed it via npm.
And I removed the line causing this issue (whitenoise.storage.MissingFileError: The file 'jquery-ui-dist/"images/ui-icons_555555_256x240.png"' could not be found ...) as like following.

https://github.com/django-helpdesk/django-helpdesk/issues/479
https://github.com/gwasser/django-helpdesk/commit/fb6e8b0566f4ab51e1bbf512b8724feab8ee3530

They remove some lines of comment in jquery-ui.min.css.
Then I could use jquery-ui on heroku.
It will work, but I really would like to install it via npm.

siruku6
  • 339
  • 3
  • 7