Includes without local server?

2019-08-02 02:53发布

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.

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

1条回答
我只想做你的唯一
2楼-- · 2019-08-02 03:11

Not really.

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.

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.

查看更多
登录 后发表回答