Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mincss/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.11.2'
__version__ = '0.11.3'
2 changes: 1 addition & 1 deletion mincss/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def commentmatcher(match):

for temp_key, old, __ in inner_improvements:
assert old in content, old
content = content.replace(old, temp_key)
content = content.replace(old, temp_key, 1)

_regex = re.compile('((.*?){(.*?)})', re.DOTALL | re.M)

Expand Down
12 changes: 12 additions & 0 deletions tests/duplicate-media-queries.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<style>
@media screen and (min-width: 600px) { p { display: none; } }
@media screen and (min-width: 600px) { p { display: none; } }
</style>
</head>
<body>
<p>Hello world</p>
</body>
</html>
13 changes: 13 additions & 0 deletions tests/test_mincss.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,16 @@ def test_before_after(self):
after = p.inlines[0].after
ok_('ul li:after { content: "x"; }' not in after)
ok_('ol li:before { content: "x"; }' in after)

def test_duplicate_media_queries(self):
"""if two media queries look exactly the same, it shouldn't fail.

This is kinda hackish but it desperately tries to solve
https://github.com/peterbe/mincss/issues/46
"""
html = os.path.join(HERE, 'duplicate-media-queries.html')
url = 'file://' + html
p = Processor()
p.process(url)
snippet = '@media screen and (min-width: 600px) {'
eq_(p.inlines[0].after.count(snippet), 2)