Windows 上更少的 CSS
尝试在我的 Windows 机器上设置 LESS for CSS,我安装了 ruby 和 rubygems 并按照 说明完全正确。
我已将 teststyle.less
放入 C:\
中。
当我输入
lessc teststyle.less
将其编译为 .css 文件时,出现错误:
The filename, directory name, or volume label syntax is incorrect.
Out of thoseimited with LESS, do all of you have a Solution to my Problem?
是不是我安装的时候搞砸了?
Trying to set up LESS for CSS on my Windows box, I've installed ruby and rubygems and followed the instructions exactly.
I have put teststyle.less
in C:\
.
When I type
lessc teststyle.less
to compile it into a .css file, I get an error:
The filename, directory name, or volume label syntax is incorrect.
Out of those familiar with LESS, do any of you have a solution to my problem?
Did I mess up the install?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
如果你不想在 Windows 上使用 GUI 编译 LESS,有一个干净的方法可以在 Windows 命令行上获取 lessc 命令。它只需要你安装node.js,无论如何,这是原始lessc所需要的。
因此,安装node.js (http://nodejs.org/) 并安装node.js 的“less”模块。后者还提供 lessc 可执行文件(Windows 上的 lessc.cmd),因此您只需确保它位于 Windows 中的 PATH 下即可。
如果您还没有 Node.js,请参阅以下分步说明:
>; npm install less
(确保仅从 Node.js 安装目录执行此操作)lessc.cmd
到node_modules/。 bin/
目录。将此目录添加到 PATHlessc
来源:http://pragmatictim.blogspot.fr/2012/08/developing-with-less-on-windows-getting.html
If you don't want to use GUI to compile LESS on Windows, there is a clean way to get lessc command on Windows command line. It only requires you to install node.js, which is required by original lessc anyway.
So, install node.js (http://nodejs.org/) and install "less" module for node.js. The latter provides lessc executable (lessc.cmd on Windows) as well, so you should only make sure it gets under your PATH in Windows.
If you don't have node.js yet, here are step-by-step instructions:
> npm install less
(make sure you do so from node.js installation directory only)lessc.cmd
tonode_modules/.bin/
directory. Add this directory to PATHlessc
as usualSource: http://pragmatictim.blogspot.fr/2012/08/developing-with-less-on-windows-getting.html
您应该查看 http://www.dotlesscss.org/,较少移植到 C# 并专门为 .网。您可以使用处理程序或编译。
使用了六个月左右,非常好。
哎呀...看到了窗户并假定了点网,也许那不是您的环境。如果没有的话,没关系...
You should look at http://www.dotlesscss.org/, less ported to C# and specifically designed for .NET. You can use either a handler or compile.
Been using it for about six months, it's great.
Oops...saw windows and assumed dot net, perhaps that's not your environment. If not, never mind...
编辑:
lessc 现在可以在 Windows 上运行。请参阅有关命令行 LESS 工具的 Github 页面安装和使用说明。 包含 LESS GUI 列表的 Github 页面 工具也可能很有趣。
原始答案:
less.js 的 lessc 命令行工具在 Windows 上不起作用。如果您想要命令行编译 LESS 文件,您应该查看 这篇文章。
另请务必查看 WinLess。 WinLess 是 LESS 的编译器(带有 GUI)。 WinLess 可以监视您的 LESS 文件,并在它们发生更改时自动编译它们。
如果您在项目中使用 Visual Studio,您还应该查看 winless.org 的 BuildEventScript。
当您使用不同的程序编译 LESS 代码时,请务必检查正在使用哪个编译器。如果您使用的程序使用不同的编译器,您应该注意互操作性问题(LESS 代码可以在一个编译器上正常工作,但不能在另一个编译器上正常工作)。
Edit:
lessc does work on Windows now. See the Github page about commandline LESS tools for installation and usage instructions. The Github page with a list of LESS GUI tools might also be interesting.
Original answer:
The lessc command line tool for less.js doesn't work on Windows. If you want command line compiling of your LESS files you should check out this post.
Also be sure to check out WinLess. WinLess is a compiler (with GUI) for LESS. WinLess can watch your LESS files, and automatically compile them when they have changed.
If you are using Visual Studio for your projects you should also check out the BuildEventScript of winless.org.
Be sure to check which compiler is being used when you are using different programs to compile your LESS code. If you are using programs which use different compilers you should watch out for interoperability issues (LESS code working correctly with one compiler, but not with another).
仅供参考,我发现这个 Windows 命令行工具将 LESS 编译为 CSS 很有用。它使用 less.js 来进行编译。命令语法不是很优雅,但效果很好。
https://github.com/duncansmart/less.js-windows
FYI, I found this Windows command line tool to compile LESS into CSS useful. It uses less.js to do the compilation. The command syntax is not very graceful, but it works well.
https://github.com/duncansmart/less.js-windows
我刚刚开始使用 Crunch 来编译 Bootstrap 非常棒。它基于 Adobe Air 构建,如果您还没有安装它,则必须安装它。
I just started using Crunch to compile Bootstrap and its pretty awesome. Its built on Adobe Air, which you will have to install if you don't already have it.
我想我发现了问题。在我的第一次安装中,我安装到 C:\Program Files\Ruby
所以我卸载并尝试了默认的“C:\Ruby”安装路径。似乎解决了这个问题,现在可以正常工作了。谢谢。
I think I found the problem. In my first installation I installed to C:\Program Files\Ruby
so I uninstalled and tried the default 'C:\Ruby' install path. Seems to fix the problem and it now works correctly. Thanks.
我有一个重新编译的 DotlessCss 版本,它可以从标准输入接受更少的代码,并将 css 代码输出到标准输出。我已将其附加在以下链接适用于 Windows 的 LESS CSS 编译器
I have a recompiled version of DotlessCss that can accept less code from standard input and output the css code to the standard output. I have attached it at the following link LESS CSS Compiler for Windows
只有这个 https://github.com/leafo/lessphp PHP 编译器没有因我的疯狂项目而崩溃LESS 中导入 CSS 的结构等。
用于将 LESS 编译为 CSS 的非常简单的 shell 命令:
Only this https://github.com/leafo/lessphp PHP compiler didn't crashed with my crazy project structure with CSS imports in LESS, etc.
Very simple shell command for compiling LESS to CSS:
您可以使用 Windows 版 Prepros 应用。它可以编译 less、sass、jade、stylus、markdown、coffeescript 和 haml,并具有实时浏览器刷新功能。
You can use Prepros App for windows. It can compile less, sass, jade, stylus, markdown, coffeescript and haml with live browser refresh.