shunai
V2EX  ›  问与答

各位前端大神,请教下 html 页面如何 include 一些通用片段

  •  
  •   shunai · Jan 22, 2015 · 5822 views
    This topic created in 4304 days ago, the information mentioned may be changed or developed.

    现在每个页面都写一个完整的页面,改起来要崩溃了

    目前想到用php, jsp

    但是上面的内容都需要后台知识和后台开发环境

    17 replies  •  2015-01-22 12:09:10 +08:00
    wwwap
    wwwap
    Jan 22, 2015
    1
    nginx ssi
    manhere
    manhere
    Jan 22, 2015 via iPhone
    2
    js的document.write大法
    chairuosen
    chairuosen
    Jan 22, 2015 via Android
    3
    angularjs 的 ng-include或者 directive
    lerry
    lerry
    Jan 22, 2015
    4
    用前端框架,比如backbone
    或者用js去加载,这个我不知道有没有现成的库
    leafx
    leafx
    Jan 22, 2015 via Android
    5
    ssi +1
    blue0125
    blue0125
    Jan 22, 2015❤️1
    6
    juicy
    juicy
    Jan 22, 2015
    7
    比起 apache和nginx 的 ssi, 我觉得用一些项目级别的工具如grunt的ssi更好
    bladecamper
    bladecamper
    Jan 22, 2015
    8
    搭个grunt构建环境吧,grunt-includes插件,让你爽到不行。
    kisshere
    kisshere
    Jan 22, 2015 via Android
    9
    楼上的,为啥我第一反应是iframe
    guangwong
    guangwong
    Jan 22, 2015
    10
    SSI
    learnshare
    learnshare
    Jan 22, 2015
    11
    用 Angular 就不是那么简单了,后端合成不同的文件吧
    ghbjy1128
    ghbjy1128
    Jan 22, 2015
    12
    后端用什么,你就用什么呗,记得项目开始前约定好目录结构。
    virusdefender
    virusdefender
    Jan 22, 2015
    13
    使用前端框架 可以动态的加载模板 比如 angular avalon 等 否则只能后端处理了
    binux
    binux
    Jan 22, 2015
    14
    这我必须推荐 HTML Imports #include for the web 啊!
    http://www.html5rocks.com/en/tutorials/webcomponents/imports/
    otarim
    otarim
    Jan 22, 2015
    15
    用 nodejs 吧,配合 swig 之类的模板,自己维护的话比较方便
    jacob
    jacob
    Jan 22, 2015 via iPhone
    16
    ctrl v吧
    vizon
    vizon
    PRO
    Jan 22, 2015
    17
    用jade写,然后用gulp-jade来转成html文件
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3062 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 75ms · UTC 11:12 · PVG 19:12 · LAX 03:12 · JFK 06:12
    ♥ Do have faith in what you're doing.