
textmate 主题
Naturally, you want your lint tools integrated with your text editor. Here's what I did to integrate Stylelint (hello!) with TextMate.
自然,您希望将皮棉工具与文本编辑器集成在一起。 这是我将Stylelint ( hello! )与TextMate集成在一起的工作。
新捆绑 (New Bundle)
In TextMate... menu Bundles / Edit Bundles...
. I didn't see a way to add a new Command, so I right-clicked an existing one (one with a C
icon for Command), selected Find in Finder
and just duplicated it. This way it appears in the bundle editor and you can tweak.. To create a new command, go File / New
and choose "Command" in the prompt.
在TextMate ...菜单Bundles / Edit Bundles...
。 我没有找到添加新命令的方法,因此我右键单击了一个现有命令(一个带有C
图标的Command),选择了Find in Finder
并进行了复制。 这样,它就会出现在包编辑器中,您可以进行调整。 。 要创建新命令,请转到“ File / New
”,然后在提示中选择“命令”。
路径正确 (PATH is in order)
You need to have the path to node
and to stylelint
(likely the same) in your TextMate path preferences (menu TextMate / Preferences / Variables / PATH). To tell where node is, type `which node`.
您需要在TextMate路径首选项(菜单TextMate / Preferences / Variables / PATH)中具有指向node
和stylelint
的路径(可能相同)。 要确定节点在哪里,请键入“哪个节点”。
全局配置 (Global config)
Stylelint needs a config. See last post on how to setup a global one.
Stylelint需要配置。 请参阅最后一篇文章,了解如何设置全局的。
设置新命令 (Setting up the new command)
Here's a screenshot of my setup:
这是我的设置的屏幕截图:

Basically run Stylelint when pressing CMD+L. Show the results in a tooltip.
按下CMD + L时基本上运行Stylelint。 在工具提示中显示结果。
And some magic to find the first error to move the cursor there:
还有一些魔术可以找到将光标移到那里的第一个错误:
#!/usr/bin/env ruby18
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
error = `stylelint "$TM_FILEPATH"`
if error.empty?
puts 'No lint errors'
else
puts error
TextMate.go_to :line => $1, :column => $2 if error =~ / (\d+):(\d+)/
end
在行动(In action)
And here is the whole integration in action. The lint finds an error and helpfully moves the cursor there.
这是整个整合的过程。 棉绒发现错误,并有帮助地将光标移到那里。

Tell your friends about this post on Facebook and Twitter
在Facebook和Twitter上告诉您的朋友有关此帖子的信息
textmate 主题