diff --git a/pipeline/compressors/__init__.py b/pipeline/compressors/__init__.py index 4926ea76..ea9eb1a6 100644 --- a/pipeline/compressors/__init__.py +++ b/pipeline/compressors/__init__.py @@ -23,17 +23,7 @@ DEFAULT_TEMPLATE_FUNC = "template" TEMPLATE_FUNC = r"""var template = function(str){var fn = new Function('obj', 'var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(\''+str.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/<%=([\s\S]+?)%>/g,function(match,code){return "',"+code.replace(/\\'/g, "'")+",'";}).replace(/<%([\s\S]+?)%>/g,function(match,code){return "');"+code.replace(/\\'/g, "'").replace(/[\r\n\t]/g,' ')+"__p.push('";}).replace(/\r/g,'\\r').replace(/\n/g,'\\n').replace(/\t/g,'\\t')+"');}return __p.join('');");return fn;};""" -MIME_TYPES = { - '.png': 'image/png', - '.jpg': 'image/jpeg', - '.jpeg': 'image/jpeg', - '.gif': 'image/gif', - '.tif': 'image/tiff', - '.tiff': 'image/tiff', - '.ttf': 'font/truetype', - '.otf': 'font/opentype', - '.woff': 'font/woff' -} +MIME_TYPES = settings.EMBED_MIME_TYPES EMBED_EXTS = MIME_TYPES.keys() FONT_EXTS = ['.ttf', '.otf', '.woff'] diff --git a/pipeline/conf.py b/pipeline/conf.py index 76db1c31..d18e22cb 100644 --- a/pipeline/conf.py +++ b/pipeline/conf.py @@ -82,6 +82,17 @@ 'EMBED_MAX_IMAGE_SIZE': 32700, 'EMBED_PATH': r'[/]?embed/', + 'EMBED_MIME_TYPES': { + '.png': 'image/png', + '.jpg': 'image/jpeg', + '.jpeg': 'image/jpeg', + '.gif': 'image/gif', + '.tif': 'image/tiff', + '.tiff': 'image/tiff', + '.ttf': 'font/truetype', + '.otf': 'font/opentype', + '.woff': 'font/woff' + }, }