简体   繁体   English

vmware-clarity / Angular4中的代码突出显示不起作用

[英]Code highlight in vmware-clarity/Angular4 not working

So I'm trying to use the Code Highlight from the VMware Clarity project in my angular project. 因此,我尝试在我的角度项目中使用VMware Clarity项目中的代码突出显示。 But I am having no succes in implementing it succesful. 但是我没有成功实现它。

I added these lines to my index.html as per documentation. 我根据文档将这些行添加到了index.html中。 But that only gives me errors. 但这只会给我带来错误。

<link rel="stylesheet" href="node_modules/prismjs/themes/prism-solarizedlight.css">
<script src="node_modules/prismjs/prism.js"></script>
<script src="node_modules/prismjs/components/prism-typescript.min.js"></script>

错误 I then tried adding it to the scripts element in the angular.cli. 然后,我尝试将其添加到angular.cli中的scripts元素中。 To no avail. 无济于事。

I'm kinda lost on what to do next since documentation and answers are lacking.. 由于缺少文档和答案,我有点不知所措。

[Edit] I do have prismjs installed with npm. [编辑]我确实在npm上安装了prismjs。

You need to add the stylesheets and the scripts in angular-cli.json 您需要在angular-cli.json添加样式表和脚本

...
"styles": [
    ...
    "../node_modules/clarity-ui/clarity-ui.min.css",
    "../node_modules/prismjs/themes/prism-solarizedlight.css",
    ...
],
"scripts": [
    ...  
    "../node_modules/prismjs/prism.js",
    "../node_modules/prismjs/components/prism-typescript.min.js",
    ...
],
...

Refer to this file for more info: https://github.com/vmware/clarity/blob/new-website/angular-cli.json#L19 有关更多信息,请参考此文件: https : //github.com/vmware/clarity/blob/new-website/angular-cli.json#L19

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

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