Angular CLI 'ng serve' 忽略更少并使用可用的 css [英] Angular CLI 'ng serve' to ignore less and use available css

查看:34
本文介绍了Angular CLI 'ng serve' 忽略更少并使用可用的 css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 Angular CLI 用于 Angular2 项目.而且我的造型使用较少.

I am using Angular CLI for Angular2 project. And I am using less for my styling.

要使用 Angular CLI 编译 less 文件,我必须导入 less 文件及其绝对路径.这打破了编辑器的智能感知.因此,我不想使用 AngularCLI 附带的 LESSPlugin,而是想使用 IDE 的 less watcher 和编译器(在 vs code 和 webstorme 中可用)来将 less 编译为 css.

To compile less file with Angular CLI, I have to import less file with its absolute path. Which breaks editor's intellisense. So instead of using LESSPlugin comes with AngularCLI, I want to use IDE's less watcher and compiler (available in vs code as well as webstorme) to compile less to css.

但是源代码中仍然存在较少的文件,'ng serve' 尝试编译更少,这会破坏构建.

But there are less files still exists in source, 'ng serve' try to compile less and that breaks the build.

有没有办法配置 angular cli 以忽略较少的文件并使用源文件夹中的可用 css?

Is there any way to configure angular cli to ignore less file and use available css in source folder?

推荐答案

我设法通过使用 'npm uninstall less --save-dev' 从项目中卸载 less 模块

I manage to do that by uninstalling less module from project using 'npm uninstall less --save-dev'

现在我可以使用相对路径来减少导入,并且智能感知现在也可以工作了.

Now I can use relative path for less import and also intellisense is working now.

这篇关于Angular CLI 'ng serve' 忽略更少并使用可用的 css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆