通过 phantomJS 编译 lesscss 文件
hej 我在使用 Maven 构建项目时想到了编译 lesscss 文件。 查看 lesscss 站点,可以编译那些在 html 文件的 head 部分引用它们的文件,就像这个
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>
幻影的脚本可以访问本地硬盘驱动器上的任何文件一样,因此应该可以循环遍历 *.less 文件。现在的问题是如何编译这些文件并以 css 扩展名保存它们。
遗憾的是,命令行仅在安装到节点时才可用(或者也许我错了?)
感谢您的任何提示
hej I got idea to compile lesscss files while building my project with maven.
looking at lesscss site it is possible to compile those files referencing them in head section of html file like this
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>
phantom's script can access any file on local hard drive so it should be possible to loop over *.less files. now the question is how to compile those files and save them back with css extension.
the pity is that command line is available only when installed to node (or maybe I wrong??)
thanks for any hint
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在第二次尝试之后,我创建了这个脚本
,它应该将解析后的 css 打印到控制台
well after giving it a second try I created this script
it should print parsed css to console
尝试 lesscss maven 插件 https://github.com/marceloverdijk/lesscss-maven-plugin
它使用 rhino,所以不是 100ms,而是需要 3000ms,但它可以工作,你所做的就是将一些 xml 放入 pom.xml
try lesscss maven plugin https://github.com/marceloverdijk/lesscss-maven-plugin
it uses rhino, so instead of 100ms it'll take 3000ms, but it works and all you do is put some xml into pom.xml