当django压缩css时,它会将输出保存到/static/CACHE/css/[filename].css中的文件中,但无论我尝试什么,css文件都会一直空白!
在我的模板中......
{% 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已设置
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) 永远是空的!
答案 0 :(得分:0)
您是通过npm还是通过ruby gem安装的?如果是后者,请尝试更新为:
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} > {outfile}'),
)