Intellij IDEA 11:如何从 .less 编译 .css?

发布于 2024-12-26 06:43:13 字数 65 浏览 3 评论 0 原文

如何在 intellij 中从 .less 编译 .css ?当然这应该很容易,但它让我难住了。有人知道该怎么做吗?

how can I compile .css from .less in intellij ? sure this should be dead easy, but its got me stumped. anyone know how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

清风无影 2025-01-02 06:43:13

我写了一个 LESS 编译器插件,每当 LESS 文件出现时,它会自动将 LESS 文件编译为 CSS改变。

您可以配置多个 LESS 目录来监视每个项目,每个目录的输出将被复制到您指定的一个或多个输出 CSS 目录:

LESS Compiler 项目设置窗口

您可以使用设置对话框中的路径模式包含/排除特定文件。

它还会检测您何时移动、复制或删除监视的 LESS 文件,并提议对相应的 CSS 文件执行相同的操作。

该插件是开源的,因此您可以在 GitHub 上查看并派生源代码(如果您愿意)喜欢。

I wrote a LESS Compiler plugin that automatically compiles LESS files to CSS whenever they change.

You can configure multiple LESS directories to watch per project, and the output of each will be copied to one or more output CSS directories that you specify:

LESS Compiler project settings window

You can include / exclude specific files by using path patterns in the settings dialog.

It will also detect when you move, copy, or delete a watched LESS file and offer to perform the same operation on the corresponding CSS file(s).

The plugin is open source, so you can view and fork the source code on GitHub if you like.

情绪失控 2025-01-02 06:43:13

要使用 File Watchers 在 IDEA 12 中编译 LESS:

从 IDEA 中安装 File Watchers 扩展。转到设置>; IDE设置>插件。

接下来,您需要一个转码器,它包含在node.js的LESS包中

node.js rel="noreferrer">http://nodejs.org/

在命令行中,键入 npm install -g less 以安装 LESS 包。

然后您可以在设置>下创建一个观察者。项目设置>文件观察者。选择 LESS 模板,它会自动找到您的转码器。

To use File Watchers to compile LESS in IDEA 12:

Install File Watchers extension from within IDEA. Go to Settings > IDE Settings > Plugins.

Next you need a transcoder, which is included in the LESS package for node.js

Install node.js from http://nodejs.org/

From the command line, type npm install -g less to install the LESS package.

Then you can create a watcher under Settings > Project Settings > File Watchers. Choose the LESS template and it will find your transcoder automatically.

顾忌 2025-01-02 06:43:13

IntelliJ IDEA 依赖 Web 框架和第三方部署工具来执行此任务。有一个在内部执行此类编译的功能请求,请随意投票。

IntelliJ IDEA relies on web frameworks and third-party deployment tools to perform this task. There is a feature request to perform such compilation internally, feel free to vote.

め七分饶幸 2025-01-02 06:43:13

我知道这个问题是针对 IntelliJ IDEA 11 的,但是如果您在搜索 v12 时找到了此页面,那么有一个比 LESS 编译器插件更好的选项(这是一个很棒的插件 - 非常感谢它,Andy! )。

这是一个名为 File Watchers 的插件,由 JetBrains 团队制作。它与 WebStorm 6 和 PhpStorm 6 捆绑在一起,但您必须下载并安装其他 JetBrians IDE。步骤:

设置->插件 ->浏览存储库(底部按钮)->搜索“文件观察者”->选择文件观察器->点击顶部的下载图标 ->关闭->好的有关

JetBrains 博客

I know this question is for IntelliJ IDEA 11, but if you found this page even though you're searching for v12, there's an option better than the LESS compiler plugin (which was a great plugin -- thanks a lot for it, Andy!).

It's a plugin called File Watchers, made by the JetBrains team. It comes bundled with WebStorm 6 and PhpStorm 6, but you have to download and install for the other JetBrians IDEs. Steps:

Settings -> Plugins -> Browse repositories (button at the bottom) -> search for "file watchers" -> select File Watchers -> click download icon at top -> Close -> OK

More info on JetBrains blog.

风轻花落早 2025-01-02 06:43:13

您可以使用以下参数设置文件观察器:

名称:更少

描述:将.less文件编译为.css文件

文件类型:LESS 文件

范围:项目文件

程序:C:\Users\Owner\AppData\Roaming\npm\lessc.cmd

参数:--no-color $FileDir$\$FileName$

工作目录:您的工作目录

刷新的输出路径:$FileDir$\$FileNameWithoutExtension$.css

You can set a File Watcher with the following parameters:

Name: LESS

Description: Compiles .less files into .css files

File Type: LESS files

Scope: Project Files

Program: C:\Users\Owner\AppData\Roaming\npm\lessc.cmd

Arguments: --no-color $FileDir$\$FileName$

Working Directory: your working directory

Output Paths to Refresh: $FileDir$\$FileNameWithoutExtension$.css

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文