简体   繁体   English

如何在不使用 grunt 或 gulp 的情况下在 Node JS 中 LINT 和 SCSS 文件?

[英]How could you LINT your LESS and SCSS files in Node JS WITHOUT using grunt or gulp?

So the thing is I went through the internet and checked for available linters.所以问题是我浏览了互联网并检查了可用的 linter。 Mostly all the the LESS linters available provide a command line interface or a plugin for grunt or gulp.大多数可用的 LESS linters 都提供命令行界面或 grunt 或 gulp 插件。 What I really want is a simple Node Plugin which is configurable and usable with NODEJS through Code and not through CLI.我真正想要的是一个简单的 Node 插件,它可以通过代码而不是通过 CLI 与 NODEJS 一起配置和使用。

Also due to unavailability of the tags such as LESSLINT and SCSSLINT could not add those tags to the questions.同样由于 LESSLINT 和 SCSSLINT 等标签不可用,无法将这些标签添加到问题中。

  1. Is there any node plugin available to do this?是否有任何节点插件可用于执行此操作?
  2. If not, How can I use CLI through NodeJS and also get the callbacks?如果没有,我如何通过 NodeJS 使用 CLI 并获得回调?

I need the callbacks since that's the most powerful feature of NodeJS and besides my code is dependent on the callbacks..我需要回调,因为这是 NodeJS 最强大的功能,而且我的代码依赖于回调。

PS: I do not need any code, all I need is directions. PS:我不需要任何代码,我只需要方向。

Thanks for the support感谢您的支持

A Node port of scss-lint was recently released, you can get it here: https://github.com/FWeinb/scsslint最近发布了一个 scss-lint 的 Node 端口,可以在这里获取: https : //github.com/FWeinb/scsslint

It can be used either in Grunt or just as a normal Node module.它可以在 Grunt 中使用,也可以作为普通的 Node 模块使用。

LESS has built-in linting, but it doesn't seem to be accessible through Node. LESS 具有内置的 linting,但它似乎无法通过 Node.js 访问。 You can use spawn or exec and the LESS CLI with the --lint flag.您可以使用spawnexec以及带有--lint标志的 LESS CLI。 See the LESS docs here: http://lesscss.org/usage/#command-line-usage-options请参阅此处的 LESS 文档: http : //lesscss.org/usage/#command-line-usage-options

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM