gpt4 book ai didi

不使用 php 或 rails 等的 html 模板

转载 作者:行者123 更新时间:2023-11-28 00:05:31 25 4
gpt4 key购买 nike

我正在寻找一种无需使用任何“后端”语言(如 php 或 ruby​​/rails)即可对 html 模板进行编码的方法。

使用 JS 可以工作,但是当我在加载 DOM 后添加节点时,我当前的 javascript 有问题。

理想的解决方案是,如果有某种预处理器,我可以将其编译成完成的 html.. 类似于 SCSS,但用于 html

所以我很清楚,我有足够的内容用于 stackoverflow..

我希望将 partial.folders 内容编译成 index.html

partial.folder
menu.html
root.html
footer.html
|
|
V
index.html

最佳答案

取决于您“何时”想要解析模板。

1) 在运行时:你可以尝试使用 https://github.com/janl/mustache.js - javascript 无逻辑模板

2) 在构建时:我建议使用 nodejs+Grunt ( http://gruntjs.com/ ) + grunt-preprocess (grunt plugin)

关于不使用 php 或 rails 等的 html 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18751559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com