Change bundle path and fix relative URL's #41
base: master
Are you sure you want to change the base?
Conversation
I should also probably point out the reason for bundling to the I happened to have a bundle called Now admittedly, this is a silly edge case that would normally not be an issue, and is pretty easy to get around. But I generally like the idea of tossing bundled files in another folder because it also keeps file clutter down in my js/css folders. |
|
||
parse = lambda url: self._fix_urls_regex(url, relpath) | ||
|
||
css_parsed = re.sub('url\(([^)]*?)\)', parse, css_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a raw string, like this
css_parsed = re.sub(r'url\(([^)]*?)\)', parse, css_content)
Otherwise, python and re get confused about the back slashes.
If someone updates to this, will they be hosed? Are there things they need to do to update to this version? |
@@ -34,6 +34,7 @@ class Command(BaseCommand): # pragma: no cover | |||
minify_skipped = 0 | |||
cmd_errors = False | |||
ext_media_path = os.path.join(get_media_root(), 'external') | |||
bundles_dir = getattr(settings, 'BUNDLES_DIR', 'bundled') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this not in get_media_root()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I decide to not set settings.BUNDLES_DIR
can we not do the bundled/
stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure i could default that to .
@willkg with the new change to the default value of |
Test added ^ |
And now tests pass ^ If this is all good I'll squash and push |
@cvan any outstanding comments here? @rehandalal Still want to get this merged in? |
@@ -3,3 +3,4 @@ jingo==0.4 | |||
Fabric==1.4.3 | |||
-e git://github.com/jbalogh/django-nose.git@83c7867c3f90ff3c7c7471716da91b643e8b2c01#egg=django_nose-dev | |||
mock==1.0b1 | |||
GitPython==0.1.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find where you use that package in the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unrelated but missing. There's a test in #63 that demonstrates the issue. Any new tests that hit that area of code will trip over it.
I can't understand why there is the |
"""Run over the regex; Fix relative URL's""" | ||
url = url.group(1).strip('"\'') | ||
if url.startswith(('data:', 'http:', 'https:')): | ||
return url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that one be wrapped in url()
too?
This needs to be updated after the PR is merged into master at: jsocol/jingo-minify#41
This needs to be updated after the PR is merged into master at: jsocol/jingo-minify#41
This needs to be updated after the PR is merged into master at: jsocol/jingo-minify#41
This needs to be updated after the PR is merged into master at: jsocol/jingo-minify#41
This needs to be updated after the PR is merged into master at: jsocol/jingo-minify#41
I just did the following:
I still think this is pretty useful! r? |
@jsocol think you could have a quick look-see at this? THANKS! |
I can but not for another day or so, and I don't have the context that @cvan would |
return (_get_item_path('js/%s-min.js?build=%s' % (bundle, build_id,)),) | ||
item = 'js/%s-min.js?build=%s' % (bundle, build_id,) | ||
item = os.path.join(getattr(settings, 'BUNDLES_DIR', ''), item) | ||
return (_get_item_path(item),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why again do we return a tuple of one item?
looking good. sorry it's taken so long to get this in. I don't think we've understood the use case here, hence the delays. |
I'll clean up the code. For me, this is why I made the changes:
|
@cvan fixed based on feedback ^ |
Feel free to say: "THESE ARE USELESS CHANGES AND NOBODY NEEDS THEM!".
This does a couple of things:
MEDIA_PATH/bundled/cssMEDIA_PATH/BUNDLES_DIR/css
MEDIA_PATH/bundled/jsMEDIA_PATH/BUNDLES_DIR/js
r?