Grunt模块注入HTML模板 [英] Grunt module to inject HTML templates

查看:415
本文介绍了Grunt模块注入HTML模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近开始使用Grunt作为一个Web应用程序的构建工具,我是业余爱好者开发的。我在一个文件夹中有一系列HTML文件(用作模板),我想在主HTML文件的特定位置注入该文件。



理想情况下,我也可以将每个文件包装在标签中,但必须手动将其包含在模板文件中才可接受。



是否有现有的Grunt模块来执行此操作?

编辑:我之前可能对我的问题措辞不佳。基本上,我有一个单独的HTML文件,应用程序将运行(单页应用程序,业务模拟游戏)。在一个单独的文件夹中,我有一系列HTML模板。这些模板中的每一个代表一个对话框或自定义信息页面,具有这种性质。随着应用程序的开发,越来越多的模板将会在这个文件夹中。



我不想手动在页面中包含每个模板,我想要一种自动注入他们,我可以通过Grunt管理。

解决方案

我可能迟到回答这个问题,但对于任何最终在这里,我发现了这个grunt-plugins,也许它们也能帮助你:


Recently started using Grunt as a build tool for a web app I'm hobbyist developing. I have a series of HTML files (to be used as templates), in a single folder, that I'd like injected at a particular point in the main HTML file.

Ideally, I could also wrap each file in a tag, but having to manually include this in the template files themselves is acceptable.

Is there an existing Grunt module to perform this?

EDIT: I may have worded my problem poorly before. Essentially, I have a single HTML file where the app will run (Single page app, business simulation game). In a separate folder, I have a series of HTML templates. Each of these template represents a dialog, or custom info page, something of that nature. As the app is developed, more and more templates will be in this folder.

Rather than manually including each one in my page, I'd like a way to automate injecting them that I can manage through Grunt.

解决方案

I may be late to answer this question, but for anyone that end up here, I found this grunt-plugins, maybe they help you too:

这篇关于Grunt模块注入HTML模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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