包括没有本地服务器? [英] Includes without local server?

查看:119
本文介绍了包括没有本地服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,我喜欢测试所有的离线文件,而不必在每次更改时都上传文件。问题是我不能使用includes,所以当我上传时,我将不得不改变很多文件结构。

I'm making a website, and I like testing everything offline instead of having to upload files with every change I make. The problem is I can't use includes, so when I do upload, I'm going to have to change a lot of the file structure.

我不是当我只想使用includes时,希望安装像WAMP这样的本地服务器。有什么办法?

I'm not looking to install a local server like WAMP when I just want to use includes. Is there any way?

推荐答案

不是。

过程包括静态(例如,编写一个Makefile以创建您在本地查看的实际HTML文件)。有很多模板语言可以做到这一点。我想你甚至可以用JavaScript编写你的模板,并让网页浏览器进行组装。

You could process includes statically (e.g., write yourself a Makefile to create the actual HTML files you view locally). There are plenty of template languages out there that could do this. You could, I suppose, even write your templates in JavaScript and let the web browser assemble them.

但是,真的,为什么不会你希望您的测试环境与您的生产环境相匹配?这看起来很愚蠢 - 如果你的包装出了问题,你想在生存之前找出它。如果您无意中在文件中获取了图像的本地路径( C:\Documents and Settings\ ... \image.png ),您需要了解它。最好的方法是真正地在本地运行网络服务器。

But really, why wouldn't you want your test environment to match your production environment? This seems silly—if there is something wrong with your includes, you want to find out before you make it live. If you accidentally get a local path to an image (C:\Documents and Settings\…\image.png) in a file, you want to find out. The best way to do this is really to run a webserver locally.

这篇关于包括没有本地服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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