Django + Mac OSX如何使用较少的CSS? [英] Django + Mac osx how to use less css?

查看:59
本文介绍了Django + Mac OSX如何使用较少的CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac osx中,css命令行编译器也不少.但是我正在尝试一个需要使用更少CSS的项目.
另外,更少的用于压缩项目中的css文件.我该如何处理?我在较少的网站上读到它的js可以在node.js服务器上运行- http://lesscss .org/#-server-side-usage
但是我不了解如何将其与django集成. COMPRESS_PRECOMPILERS的值应该是什么?

There is no less css command line compiler in mac osx. But I am trying out a project which needs to use less css.
Also less is used to compress the css files in the project. How do I handle this? I read in less website that its js can be run on a node.js server - http://lesscss.org/#-server-side-usage
But I am not understanding how to integrate it with django. What should be the value for the COMPRESS_PRECOMPILERS ?

COMPRESS_PRECOMPILERS = (                                                       
('text/less',""),                 

)

已经解决了这个问题的人提供的任何帮助.

Any help appreciated from someone who has already solved this problem.

推荐答案

  1. 安装node.js和npm(我使用自制软件安装了node.js和 http://npmjs.org/上的说明安装npm)
  2. 使用npm install --global less
  3. 安装少命令行编译器
  4. 向COMPASS_PRECOMPILERS(方向)添加lessc.
  1. Install node.js and npm (I used homebrew to install node.js and the instructions at http://npmjs.org/ to install npm)
  2. Install the command-line less compiler with npm install --global less
  3. Add lessc to COMPASS_PRECOMPILERS (directions).

以下是相关代码段:

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

另外,COMPRESS_PRECOMPILERS来自django应用程序django_compressor,而不是来自django本身.我认为django_compressor看起来不错,但是还有其他可用选项.

Also, COMPRESS_PRECOMPILERS is from django_compressor, a django app, not from django itself. I think django_compressor looks quite good, but there are other options available as well.

这篇关于Django + Mac OSX如何使用较少的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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