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
Adding option to concatenate files before processing #289
Closed
jannon
wants to merge
5
commits into
django-compressor:develop
from
xtranormal:feature-concat-before-process-option
Closed
Adding option to concatenate files before processing #289
jannon
wants to merge
5
commits into
django-compressor:develop
from
xtranormal:feature-concat-before-process-option
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This also adds ability to specify tag options, and use 'as <name>' to name blocks
If 'deferred=true' and 'as <name>' are passed in template tag, the output of the compress tag is added to the template context as <name>. If there is no name specified in the tag, the 'deferred' option is ignored and the tag output is rendered normally. If the mode is 'file' the url of the file is used, otherwise the full rendered content is used. This will allow people to use django_compressor in conjunction with asynchronous asset loaders (e.g. yepnope.js, require.js, etc.)
Hi, jannon, thanks for Your great job! It is possible to work on merging this pull request? It would be nice to have this feauture in core django_compressor. |
Why was this never merged? :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this pull request
There are tests and documentation updates as well as the code changes
Tag Argument Order
There's not really any need to enforce a certain arrangement of arguments in the tag so let's just let people specify them however they want after the kind parameter. So now all of these are valid:
Using 'as <name>'
Lots of things in python and django use this syntax, so it would be nice to do so as well
Specifying options in the tag
Just like the
with
tag in django, you can specify an arbitrary number of keyword/value arguments to the tag. These will get put into a dictionary and passed to the Compressor classes. Also, the default compressors, add these to the options that they pass the precompilers and filters. One of the main motivations for this was to prepare for being able to specify that files should be grouped first before, say, lessc precompilation, which leads to...'group_first' option
Setting the option
group_first=true
in thecompress
template tag will cause files of the same type to be concatenated before being handed to precompilers/filters. This will allow people to do standard code decomposition with things like .less files (having a mixins file separate from page-specific files)For example:
Will concatenate the .less files so the less precompiler will properly process all the files
This provides a fix for #30