简体   繁体   English

如何使用Node.js在Hexo等框架中编辑CSS和HTML

[英]How to edit CSS and HTML in frameworks such as Hexo using Node.js

I am new to Node.js and decided to try to make a blog website using Hexo . 我是Node.js新手,并决定尝试使用Hexo创建一个博客网站。 The problem I am having is trying to edit the main style sheet and index files to include a new web font (or any editing in general). 我遇到的问题是尝试编辑主样式表和索引文件以包含新的Web字体(或一般的任何编辑)。

The way I figured it would work is I would make the change and the server would pick it, such as with the /themes folder as stated in the docs. 我认为它的工作方式是我会进行更改,服务器会选择它,例如文档中所述的/themes folder Though this is not the case and it doesn't seem like you can edit the CSS directly. 虽然情况并非如此,但您似乎无法直接编辑CSS。

How do I edit the main CSS and index in such frameworks as these? 如何编辑这些框架中的主要CSS和索引?

Hexo.io used Stylus , you can look at the documentation. Hexo.io使用了Stylus ,你可以查看文档。

I tried to make changes to the default theme and worked. 我试图对默认主题进行更改并且有效。

by examples in the path: themes \\ landscape \\ source \\ css - style.styl 通过路径中的示例:themes \\ landscape \\ source \\ css - style.styl

In Hexo, the theme is responsible for rendering and styling the content in HTML. 在Hexo中,主题负责在HTML中呈现和样式化内容。 The theme can decide what preprocessor (for CSS and HTML templating) to use. 主题可以决定使用什么预处理器(用于CSS和HTML模板)。

landscape is using Stylus for CSS and EJS (note it is 1.0) for templating. landscape正在使用Stylus for CSS和EJS (注意它是1.0)进行模板化。
You have to npm install hexo-renderer-ejs hexo-renderer-stylus for it to work. 你必须npm install hexo-renderer-ejs hexo-renderer-stylus才能工作。

There are other renderers but they are less popular. 还有其他渲染器,但它们不太受欢迎。

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

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