Django 压缩器空白 CSS 输出文件
当 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) 总是空的!
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!
In my template...
{% compress css %}
<link rel='stylesheet' type='text/less' href='{{ STATIC_URL }}css/deals_for_you.less'/>
{% endcompress %}
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}'),
)
Also, when I run
python manage.py compress
It outputs...
Found 'compress' tags in:
[/my/file/path]/index.html
Compressing... done
Compressed 1 block(s) from 1 template(s)
But the output file that I get (at /static/CACHE/css/d41d8cd98f00.css)
is always empty!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是通过 npm 还是通过 ruby gem 安装的?如果是后者,请尝试更新为:
请参阅此问题: https://github.com/jezdez /django_compressor/pull/177
Did you install via npm or via a ruby gem? If the latter, try updating to:
See the issue on this: https://github.com/jezdez/django_compressor/pull/177