Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
14f1960f
Commit
14f1960f
authored
Sep 24, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure we play nicely with font-face
parent
5a3b861c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
pipeline/compressors/__init__.py
+2
-4
tests/static/css/urls.css
+7
-0
tests/tests/compressor.py
+9
-1
No files found.
pipeline/compressors/__init__.py
View file @
14f1960f
...
...
@@ -4,8 +4,6 @@ import re
import
subprocess
import
urlparse
from
django.utils.encoding
import
filepath_to_uri
from
pipeline.conf
import
settings
from
pipeline.storage
import
storage
from
pipeline.utils
import
to_class
...
...
@@ -13,7 +11,7 @@ from pipeline.utils import to_class
MAX_IMAGE_SIZE
=
32700
EMBEDDABLE
=
r'[/]?embed/'
URL_DETECTOR
=
r'url\([\'"]?([^\s)]+\.[a-z]+)[\'"]?\)'
URL_DETECTOR
=
r'url\([\'"]?([^\s)]+\.[a-z]+
[#?]?[^\s)]*
)[\'"]?\)'
URL_REPLACER
=
r'url\(__EMBED__(.+?)(\?\d+)?\)'
MHTML_START
=
"/*
\r\n
Content-Type: multipart/related; boundary=
\"
MHTML_MARK
\"\r\n\r\n
"
...
...
@@ -130,7 +128,7 @@ class Compressor(object):
asset_path
=
self
.
relative_path
(
public_path
)
return
urlparse
.
urljoin
(
settings
.
PIPELINE_URL
,
filepath_to_uri
(
asset_path
[
1
:])
asset_path
[
1
:]
)
def
embeddable
(
self
,
path
,
variant
):
...
...
tests/static/css/urls.css
View file @
14f1960f
@font-face
{
font-family
:
'Pipeline'
;
src
:
url('../fonts/pipeline.eot')
;
src
:
local
(
'☺'
),
url('../fonts/pipeline.woff')
format
(
'woff'
),
url('../fonts/pipeline.ttf')
format
(
'truetype'
),
url('../fonts/pipeline.svg#IyfZbseF')
format
(
'svg'
);
font-weight
:
normal
;
font-style
:
normal
;
}
.relative-url
{
background-image
:
url(../images/sprite-buttons.png)
;
}
...
...
tests/tests/compressor.py
View file @
14f1960f
...
...
@@ -79,10 +79,18 @@ class CompressorTest(TestCase):
self
.
assertEquals
(
asset_path
,
"http://localhost/static/images/sprite.png"
)
def
test_url_rewrite
(
self
):
self
.
maxDiff
=
None
output
=
self
.
compressor
.
concatenate_and_rewrite
([
'css/urls.css'
,
])
self
.
assertMultiLineEqual
(
""".relative-url {
self
.
assertMultiLineEqual
(
"""@font-face {
font-family: 'Pipeline';
src: url(http://localhost/static/fonts/pipeline.eot');
src: local('☺'), url(http://localhost/static/fonts/pipeline.woff') format('woff'), url(http://localhost/static/fonts/pipeline.ttf') format('truetype'), url(http://localhost/static/fonts/pipeline.svg#IyfZbseF') format('svg');
font-weight: normal;
font-style: normal;
}
.relative-url {
background-image: url(http://localhost/static/images/sprite-buttons.png);
}
.absolute-url {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment