less使用方法

  • 命令行用法

$ npm install -g less

$ lessc styles.less styles.css

lessc –clean-css styles.less styles.min.css

  • html页面直接使用

<link rel=”stylesheet/less” type=”text/css” href=”styles.less” />

<script> less = { env: “development”, async: false, fileAsync: false, poll: 1000, functions: {}, dumpLineNumbers: “comments”, relativeUrls: false, rootpath: “:/a.com/” }; </script>

<script src=”less.js” type=”text/javascript”></script>