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

Ensure generated file always contains a base name #861

Merged

Conversation

@mgjbroadbent
Copy link
Contributor

mgjbroadbent commented Jun 7, 2017

This changes the default output filename from [hash].[ext] to [name].[hash].[ext] in all cases.

This makes the output naming consistent with Whitenoise in all cases. This is because only files named as .. will be considered immutable, all other files will have the default 10 sec age set.

In addition, the user can customise the name using the block_name attribute.

  • The default name is set to output.
  • Use the block_name as the name if it's provided in the template tag.
  • When using single or multiple js/css files with no filters defined the basename of one of those files will still be used for the name (this is the existing behaviour).
  • Tests added and updated to support the name change.

This change was originally to solve #775, but this only changes the output naming convention.

@karyon karyon force-pushed the mgjbroadbent:issue-775-add-block-name branch from 874a7b7 to 37ea2ca Aug 22, 2017
…ash>.<ext> to <name>.<hash>.<ext>

* The default name is set to output.  This helps with Whitenoise integration as only files named as <name>.<hash>.<ext> will be considered immutable.
* Use the block_name as the name if it's provided in the template tag.
* When using single or multiple js/css files with no filters defined the basename of one of those files will be used for the name (this is existing behaviour).
* Tests added and updated to support the name change.
@karyon karyon force-pushed the mgjbroadbent:issue-775-add-block-name branch from 37ea2ca to 088efe2 Aug 22, 2017
@karyon

This comment has been minimized.

Copy link
Contributor

karyon commented Aug 22, 2017

hi! sorry for the late reply. i have rebased the branch and resolved the merge conflicts, and right now i'm updating more places in the documentation, i have just one question, see next comment...

@@ -27,15 +27,15 @@ Which would be rendered something like:

.. code-block:: django

<link rel="stylesheet" href="/static/CACHE/css/f7c661b7a124.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="/static/CACHE/css/one.f7c661b7a124.css" type="text/css" charset="utf-8">

This comment has been minimized.

Copy link
@karyon

karyon Aug 22, 2017

Contributor

this should be output. instead of one., right?

@karyon karyon force-pushed the mgjbroadbent:issue-775-add-block-name branch 2 times, most recently from 0e40280 to 42dea42 Aug 22, 2017
@karyon karyon requested a review from diox Aug 22, 2017
@diox
diox approved these changes Aug 23, 2017
@karyon karyon merged commit 834ad55 into django-compressor:develop Aug 26, 2017
3 checks passed
3 checks passed
codecov/patch 100% of diff hit (target 91.08197%)
Details
codecov/project 91.11982% (+0.03786%) compared to 8abd586
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@karyon

This comment has been minimized.

Copy link
Contributor

karyon commented Aug 26, 2017

@mgjbroadbent thank you very much for your contribution!

@mgjbroadbent mgjbroadbent deleted the mgjbroadbent:issue-775-add-block-name branch Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.