Grunt module to inject HTML templates

此生再无相见时 提交于 2019-12-09 11:23:42

问题


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.


回答1:


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-replace.
  • grunt-html-build.
  • grunt-processhtml.


来源:https://stackoverflow.com/questions/21270602/grunt-module-to-inject-html-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!