更少的 Linux 编译器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7245826/
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-05 05:57:21  来源:igfitidea点击:

Less Compiler for Linux

csslinuxcompiler-constructionless

提问by Rigel Glen

Is there a something like less.app that can compile LESS into CSS? I don't care about a GUI and don't want to install it via NPM (node.js package manager.)

有没有像less.app这样的东西可以将LESS编译成CSS?我不关心 GUI,也不想通过 NPM(node.js 包管理器)安装它。

采纳答案by Xaerxess

Although using node.jsversion is recommended, you can install less as ruby gem:

虽然推荐使用node.jsversion,但您可以将 less 安装为 ruby​​ gem:

sudo apt-get install rubygems1.8 ruby1.8-dev
sudo gem install rubygems-update
sudo gem update rubygems
sudo gem install less

and than use lesscwhich is in /var/lib/gems/1.8/bin/lessc, so you may want to create symlink:

而不是使用lesscwhich in /var/lib/gems/1.8/bin/lessc,因此您可能想要创建符号链接:

sudo ln -s /var/lib/gems/1.8/bin/lessc /usr/bin/

or add ruby gems dir to PATHvariable:

或将 ruby​​ gems 目录添加到PATH变量:

export PATH=/var/lib/gems/1.8/bin:$PATH

EDIT:

编辑:

Using lesscas described here:

使用lessc如下所述

Command-line usage

Less comes with a binary, which lets you invoke the compiler from the command-line, as such:

$ lessc styles.less

This will output the compiled CSS to stdout, you may then redirect it to a file of your choice:

$ lessc styles.less > styles.css

To output minified CSS, simply pass the -xoption.

命令行使用

Less 带有一个二进制文件,它允许您从命令行调用编译器,如下所示:

$ lessc styles.less

这会将编译后的 CSS 输出到 stdout,然后您可以将其重定向到您选择的文件:

$ lessc styles.less > styles.css

要输出缩小的 CSS,只需传递-x选项。

回答by Natim

You can also use this : http://wearekiss.com/simplesswith a beautiful GUI and the watching process to automatically update the file when editing.

您也可以使用它:http: //wearekiss.com/simplless带有漂亮的 GUI 和观看过程,以便在编辑时自动更新文件。

回答by Luis Lobo Borobia

I have created a wxPython GUI app that uses node.js less compiler. It is on very early stage right now. Everyone's invited to contribute. I'm planning to make it very similar to MacOS's LessCSS App.

我创建了一个 wxPython GUI 应用程序,它使用 node.js less 编译器。它现在处于非常早期的阶段。每个人都被邀请来贡献。我打算让它与 MacOS 的 LessCSS 应用程序非常相似。

https://github.com/luislobo/Lobo-LessCSS-Compiler

https://github.com/luislobo/Lobo-LessCSS-Compiler

回答by Johann

One solution is a bash script discussed here: https://www.maltheborch.com/2011/09/less-app-on-linuxAnd available as a gist here: https://gist.github.com/malthe/1234308

一种解决方案是此处讨论的 bash 脚本:https: //www.maltheborch.com/2011/09/less-app-on-linux并在此处作为要点提供:https: //gist.github.com/malthe/1234308

It requires node, lessc, and inotify-tools (a small library for watching changes to files.) Simply throw it in a file, make that file executable, then run it with a directory as the argument.

它需要 node、lessc 和 inotify-tools(一个用于监视文件更改的小型库。)只需将其放入一个文件中,使该文件可执行,然后使用目录作为参数运行它。

The downside is that while it will watch a directory recursively, it will only compile whichever file was modified--it doesn't have the ability to automatically compile the less files which import the one you're working on.

缺点是虽然它会递归地观察一个目录,但它只会编译被修改的文件——它不能自动编译导入你正在处理的文件的 less 文件。

Update:A similar option is this slightly more complex bash script which adds a few features: http://code.krml.fr/less.app

更新:一个类似的选项是这个稍微复杂的 bash 脚本,它增加了一些功能:http: //code.krml.fr/less.app

回答by Lukas Dietrich

I know, that this answer is quite "too late", but I recently tried to build a simple gui for linux. With JAVA and the less.js it is not just linux, but cross-platform. Simpless isn't supported anymore (since 1.3 as written in their blog) and Crunch uses Adobe Air which is also out of date.

我知道,这个答案“太晚了”,但我最近尝试为 linux 构建一个简单的 gui。使用 JAVA 和 less.js,它不仅是 linux,而且是跨平台的。Simpless 不再受支持(从他们博客中所写的 1.3 开始)并且 Crunch 使用的 Adob​​e Air 也已过时。

here is my project: http://project.splashfish.de/Le-css/

这是我的项目:http: //project.splashfish.de/Le-css/

回答by Ciddy Natadisastra

in fedora or centos distribution you should

在 Fedora 或 centos 发行版中,您应该

$ sudo yum install rubygems
$ sudo yum install gcc-c++
$ sudo yum install ruby-devel     
$ sudo gem install less
$ sudo gem install therubyracer 

$ lessc yourLessFile.less > yourCssFile.css

回答by Alex Objelean

For java there is an open source tool called wro4j.

对于 Java,有一个名为wro4j 的开源工具。

It uses rhino as underlying engine for compiling less to css, but can also use node.js if it is supported on your environment.

它使用 rhino 作为底层引擎,用于将 less 编译为 css,但如果您的环境支持,也可以使用 node.js。