Django压缩程序空白CSS输出文件

5
当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(测试通过)

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)总是空的!


你有哪些COMPRESS_PRECOMPILERS的选项? - Chris Pratt
COMPRESS_PRECOMPILERS = (('text/less', 'lessc {infile} {outfile}),) - zconnelly13
@ChrisPratt,将COMPRESS_ENABLED设置为False后仍然无法正常工作。 - zconnelly13
1
你确定 lessc 正常工作吗?(你可以在项目根目录下的命令行中运行 $ lessc path/to/some.less path/to/some.css)。 - Chris Pratt
@ChrisPratt 是的!lessc path/to/my.less path/to/my.css 将编译后的 CSS 输出到终端并正确地写入文件...(你可以看出我为什么感到沮丧,哈哈) - zconnelly13
显示剩余3条评论
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接