Visual Studio 代码导入自定义 css 和 js 扩展 [英] visual studio code import custom css and js extension

查看:82
本文介绍了Visual Studio 代码导入自定义 css 和 js 扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装自定义样式,以便在 Visual Studio 代码中为类和属性使用不同的字体.

I'd like to install custom styles in order to have different fonts for classes and attributes in visual studio code.

我安装了 自定义 CSS 和 JS 加载程序 扩展,并按照指南进行操作,但似乎不起作用.

I installed the Custom CSS and JS Loader extension, and followed the guide but it doesn't seem to work.

这是我尝试过的.我创建了一个文件 styles.css 我把这个代码放在那里:

Here's what I've tried. I created a file styles.css where I put this code:

.mtk1,
.mtk2,
.mtk8,
.mtk9,
.mtk10,
.mtk12,
.mtk11,
.mtk7,
.mtk3,
.mtk13,
.mtk16 {
  margin-left: 1px;
  font-family: "Indie Flower";
  font-size: 1em;

}

.mtk7,
.mtk4 {
  font-family: "Arial";
  font-size: 0.7em;
}

/*
For the tab titles.
*/
.monaco-icon-label-description-container .label-name {
  font-family: "Indie Flower";
  font-size: 1.3em;
}

.tabs-container .monaco-icon-label-description-container .label-name,
.sidebar .monaco-icon-label-description-container .label-name,
.quick-open-row .monaco-icon-label-description-container .label-name {
  font-family: -apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,Ubuntu,Droid Sans,sans-serif;
  font-size: 1em;
}

然后在 settings.json 中我添加了以下设置:

Then in settings.json I added the following settings:

{
  "vscode_custom_css.imports": ["file:///home/mat/vscode_extensions/styles.css"],
  "vscode_custom_css.policy": true
}

我通过在此目录中键入pwd 来获取路径,因此它应该是正确的路径.但是,它仍然不想应用样式,无论是 fontFamily 还是 fontSize.

I took the path by typing inside this directory pwd, so it should be correct path. However, it still doesn't want to apply styles, neither fontFamily nor fontSize.

有人知道问题出在哪里吗?

Does anyone knows where the problem is?

推荐答案

您必须以管理员身份运行 VSCode,然后在 JS 中启用 CSS.

You have to run VSCode as Administrator and then Enable CSS in JS.

位于应用程序中的 VSCode 示例路径:sudo/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron

Example path to VSCode located in Applications: sudo /Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron

并且不要忘记将所有这些自定义字体安装到您的 Mac 设备上.

And don't forget to install all those custom fonts to your Mac device.

这篇关于Visual Studio 代码导入自定义 css 和 js 扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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