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

deal with filename altering by e.g. django-compressor #94

Merged

Conversation

nimasmi
Copy link
Contributor

@nimasmi nimasmi commented Jan 26, 2015

django-compressor, with the compression option turned on, renames included js files. This means that Leaflet can't use its own filename to determine the path to image files, see https://github.com/Leaflet/Leaflet/blob/5a518194945813f4b578861799f23a94248b553e/src/layer/marker/Icon.Default.js#L23-L25.

This edit adds a settings option SET_IMAGE_PATH_MANUALLY, which will cause the file path to be written manually at the end of the generated js includes:

L.Icon.Default.imagePath = "{% static "leaflet/images" %}";

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.16%) to 80.97% when pulling c6ad19e on nimasmi:django_compressor_compatibility into e54a401 on makinacorpus:master.

@leplatrem
Copy link
Collaborator

Thanks for this contribution !

That's something we had done manually before :) See https://github.com/makinacorpus/django-mapentity/blob/master/mapentity/templates/mapentity/base.html#L119

I wonder if the option name is well chosen though. This is not really manual, but rather... automatic! We could call it with something like FORCE_IMAGE_PATH ?

@nimasmi
Copy link
Contributor Author

nimasmi commented Jan 26, 2015

Very happy to agree to a name change.

@@ -276,6 +276,21 @@ and no longer adds map objects into ``window.maps`` array by default. To restore

'NO_GLOBALS' = False

Manually specify image path
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also rephrase that to "Force Leaflet image path"

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.16%) to 80.97% when pulling f6c462f on nimasmi:django_compressor_compatibility into e54a401 on makinacorpus:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.16%) to 80.97% when pulling f6c462f on nimasmi:django_compressor_compatibility into e54a401 on makinacorpus:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.16%) to 80.97% when pulling f6c462f on nimasmi:django_compressor_compatibility into e54a401 on makinacorpus:master.

@leplatrem leplatrem merged commit f6c462f into makinacorpus:master Apr 17, 2015
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

Successfully merging this pull request may close these issues.

3 participants