Django Compressor空白Css输出文件 [英] Django Compressor Blank Css Output File

查看:244
本文介绍了Django Compressor空白Css输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当django压缩css时,它会将输出保存到/static/CACHE/css/[filename].css中的文件,但无论我尝试什么,css文件都会保持空白!

When django compresses css it saves the output to a file in /static/CACHE/css/[filename].css, however no matter what I try, the css file keeps coming out blank!

在我的模板中...

{% compress css %}
<link rel='stylesheet' type='text/less' href='{{ STATIC_URL }}css/deals_for_you.less'/>
{% endcompress %}

我安装了django_compressor,django_appconf和versiontools
我安装了lessc成功(testecd)
STATICFILES_FINDERS已设置

I installed django_compressor, django_appconf, and versiontools successfully I installed lessc successfully (testecd) STATICFILES_FINDERS are set

COMPRESS_OFFLINE = True
COMPRESS_ENABLED = True
COMPRESS_OFFLINE_CONTEXT = {
    'STATIC_URL': STATIC_URL,
}
COMPRESS_PRECOMPILERS = (
    ('text/less', 'lessc {infile} {outfile}'),
)

此外,当我运行

python manage.py compress

..

Found 'compress' tags in:
    [/my/file/path]/index.html
Compressing... done
Compressed 1 block(s) from 1 template(s)

但是我得到的输出文件(在/static/CACHE/css/d41d8cd98f00.css)
总是空的!

But the output file that I get (at /static/CACHE/css/d41d8cd98f00.css) is always empty!

推荐答案

您是通过npm安装还是通过ruby gem安装?如果是后者,请尝试更新为:

Did you install via npm or via a ruby gem? If the latter, try updating to:

COMPRESS_PRECOMPILERS = (
    ('text/less', 'lessc {infile} > {outfile}'),
)

a href =https://github.com/jezdez/django_compressor/pull/177 =nofollow> https://github.com/jezdez/django_compressor/pull/177

See the issue on this: https://github.com/jezdez/django_compressor/pull/177

这篇关于Django Compressor空白Css输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆