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 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 issue-775-add-block-name branch from 874a7b7 to 37ea2ca Compare August 22, 2017 13:54
…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 issue-775-add-block-name branch from 37ea2ca to 088efe2 Compare August 22, 2017 14:05
@karyon
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...

docs/usage.txt Outdated
@@ -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">
Copy link
Contributor

Choose a reason for hiding this comment

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

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

@karyon karyon force-pushed the issue-775-add-block-name branch 2 times, most recently from 0e40280 to 42dea42 Compare August 22, 2017 19:23
@karyon karyon requested a review from diox August 22, 2017 19:53
@karyon karyon merged commit 834ad55 into django-compressor:develop Aug 26, 2017
@karyon
Copy link
Contributor

karyon commented Aug 26, 2017

@mgjbroadbent thank you very much for your contribution!

@mgjbroadbent mgjbroadbent deleted the issue-775-add-block-name branch September 10, 2017 21:25
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