将预先存在的静态HTML页面添加到React/Gatsby站点的最快方法 [英] Fastest way to add pre-existing static HTML page to a React/Gatsby site

查看:128
本文介绍了将预先存在的静态HTML页面添加到React/Gatsby站点的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的项目,使用JSX/React/Gatsby可以很好地工作.

I have a simple project working nicely using JSX / React / Gatsby.

在另一个项目中,我有一个HTML格式的预先存在的页面(认为是登录页面),它非常复杂,使用Bootstrap 4样式精美,我们将其称为LandingPage.html和关联的LandingPage.css.

I have a pre-existing page (think landing page) in HTML in another project, quite complex, nicely styled using Bootstrap 4, let's call it LandingPage.html and an associated LandingPage.css.

我想将登录页面添加到我的Gatsby网站.这样,例如,当导航到localhost:3000/LandingPage.html时,就会显示登陆页面,设置正确的样式等.

I would like to add the landing page to my Gatsby site. So that for example when navigating to localhost:3000/LandingPage.html the landing page gets shown, properly styled etc.

我不清楚我是否必须将现有的HTML完全转换为react组件/JSX? 或者我是否可以通过将LandingPage.html(及相关的样式文件)放置在我的Gatsby项目结构中合理的位置来为其提供服务? 还是我必须创建一个反应包装器",以便在运行时"读取LandingPage.html和LandingPage.css的内容?

I am not clear whether I have to fully convert my pre-existing HTML into a react component / JSX? Or whether I can just serve the LandingPage.html (and associated styling files) by placing it somewhere sensible in my Gatsby project structure? Or whether I have to create a react "wrapper" that at "run time" reads in the content of LandingPage.html and LandingPage.css?

注意:我已经尝试过将LandingPage.html和LandingPage.css放到/public文件夹中,并且实际上可以正常工作!所以也许我已经回答了我自己的问题.但这是正确的方法吗?

Note: I've tried just putting the LandingPage.html and LandingPage.css into the /public folder and actually that does work! So maybe I've answered my own question. But is the the right way to do it?

推荐答案

那完全可行!只要确保不要在Gatsby中创建另一个覆盖您的页面的页面即可:-)

That totally works! Just make sure not to create another page within Gatsby that overwrites your page :-)

这篇关于将预先存在的静态HTML页面添加到React/Gatsby站点的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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