Windows 上的 CSS 更少

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2986204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 22:11:10  来源:igfitidea点击:

LESS CSS on Windows

csswindowsrubyless

提问by Mojave Storm

Trying to set up LESS for CSSon my Windows box, I've installed ruby and rubygems and followed the instructionsexactly.

尝试在我的 Windows 机器上为 CSS设置LESS,我已经安装了 ruby​​ 和 ruby​​gems 并完全按照说明进行操作

I have put teststyle.lessin C:\.
When I type

我已经投入teststyle.lessC:\
当我打字

lessc teststyle.less

to compile it into a .css file, I get an error:

要将其编译为 .css 文件,出现错误:

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?

在那些熟悉 LESS 的人中,你们中有人能解决我的问题吗?
我把安装搞砸了吗?

采纳答案by Mojave Storm

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.

我想我发现了问题。在我的第一次安装中,我安装到 C:\Program Files\Ruby,所以我卸载并尝试了默认的“C:\Ruby”安装路径。似乎解决了这个问题,现在它可以正常工作了。谢谢。

回答by Timur

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.

如果您不想在 Windows 上使用 GUI 来编译 LESS,则有一种干净的方法可以在 Windows 命令行上获取 lessc 命令。它只需要您安装 node.js,无论如何原始lessc都需要。

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.

因此,安装 node.js ( http://nodejs.org/) 并为 node.js 安装“less”模块。后者也提供了lessc 可执行文件(Windows 上的lessc.cmd),所以你应该只确保它在你的Windows 路径下。

If you don't have node.js yet, here are step-by-step instructions:

如果您还没有 node.js,这里是分步说明:

  • Install node.js (http://nodejs.org/)
  • In new command-line, go to node.js installation directory (where node.exe is located), and execute > npm install less(make sure you do so from node.js installation directory only)
  • Latter downloads less module for node.js, as well as lessc.cmdto node_modules/.bin/directory. Add this directory to PATH
  • Now, in new command line you may enjoy the use of lesscas usual
  • 安装 node.js ( http://nodejs.org/)
  • 在新的命令行中,转到 node.js 安装目录(node.exe 所在的位置),然后执行> npm install less(确保仅从 node.js 安装目录执行此操作)
  • 后者少的下载模块的node.js,以及lessc.cmdnode_modules/.bin/目录。将此目录添加到PATH
  • 现在,在新的命令行中,您可以lessc像往常一样享受使用

Source: http://pragmatictim.blogspot.fr/2012/08/developing-with-less-on-windows-getting.html

来源:http: //pragmatictim.blogspot.fr/2012/08/developing-with-less-on-windows-getting.html

回答by Rob

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.

您应该查看http://www.dotlesscss.org/,较少移植到 C# 并且专为 .NET 设计。您可以使用处理程序或编译。

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...

哎呀...看到窗户并假设点网,也许那不是你的环境。如果没有,没关系...

回答by Mark Lagendijk

Edit:

编辑:

lessc does work on Windows now. See the Github page about commandline LESS toolsfor installation and usage instructions. The Github page with a list of LESS GUItools might also be interesting.

lessc 现在可以在 Windows 上运行。有关安装和使用说明,请参阅有关命令行 LESS 工具Github 页面包含 LESS GUI工具列表Github 页面也可能很有趣。

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.

用于less.js 的lessc 命令行工具在Windows 上不起作用。如果你想用命令行编译你的 LESS 文件,你应该看看这篇文章

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 BuildEventScriptof winless.org.

也一定要查看WinLess。WinLess 是 LESS 的编译器(带有 GUI)。WinLess 可以监视您的 LESS 文件,并在它们发生更改时自动编译它们。如果您在项目中使用 Visual Studio,您还应该查看winless.org的 BuildEventScript。

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).

当您使用不同的程序编译 LESS 代码时,请务必检查正在使用的编译器。如果您正在使用使用不同编译器的程序,您应该注意互操作性问题(LESS 代码与一个编译器一起正常工作,但不能与另一个编译器一起工作)。

回答by thaddeusmt

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.

仅供参考,我发现这个将 LESS 编译为 CSS 的 Windows 命令行工具很有用。它使用 less.js 进行编译。命令语法不是很优雅,但效果很好。

https://github.com/duncansmart/less.js-windows

https://github.com/duncansmart/less.js-windows

回答by Jeremy D

I just started using Crunchto compile Bootstrapand its pretty awesome. Its built on Adobe Air, which you will have to install if you don't already have it.

我刚开始使用Crunch来编译Bootstrap,它非常棒。它建立在 Adob​​e Air 之上,如果您还没有安装,则必须安装它。

回答by digitalPBK

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

我有一个重新编译的 DotlessCss 版本,它可以接受来自标准输入的更少代码并将 css 代码输出到标准输出。我已将其附加到以下链接LESS CSS Compiler for Windows

回答by Dmitriy

Only this https://github.com/leafo/lessphpPHP compiler didn't crashed with my crazy project structure with CSS imports in LESS, etc.

只有这个https://github.com/leafo/lessphpPHP 编译器没有因为我在 LESS 中导入 CSS 的疯狂项目结构而崩溃,等等。

Very simple shell command for compiling LESS to CSS:

用于将 LESS 编译为 CSS 的非常简单的 shell 命令:

plessc input.less > output.css

回答by Subash Pathak

You can use Prepros Appfor windows. It can compile less, sass, jade, stylus, markdown, coffeescript and haml with live browser refresh.

您可以使用适用于 Windows 的Prepros 应用程序。它可以编译less、sass、jade、stylus、markdown、coffeescript和haml,实时浏览器刷新。