问题描述
我使用HTML/CSS,JavaScript和Sass或Scss开发了一个网站前端.我使用了NPM.
I developed a website front-end using HTML/CSS, JavaScript and Sass or Scss. I used NPM.
我需要将该网站放入WordPress.我已经安装了WordPress,并将包含所有资产(HTML/CSS,JS,Sass等)的文件夹放入主题文件夹.
I need to put that website into WordPress. I already installed WordPress and put that folder with all my assets(HTML/CSS, JS, Sass etc..) into theme folder.
现在,我现在该怎么办?如何连接所有这些?
Now, what do I do now? How do I connect all of this?
我知道这是有可能的,因为我之前在这样的网站上工作过,但不确定如何从头开始.
I know it's possible because I have worked on a site like this before at work, but not sure how to do it from the ground up.
Webpack-> WordPress.我将使用NPM或Webpack观看文件,但是托管将通过MAMP进行-无论如何,这就是我的工作方式.
Webpack -> WordPress. I will watch the files with NPM or webpack, but the hosting will be doing with MAMP - that's how I did it at work anyways.
我该怎么办?
这是网站代码(如果有的话): https://github.com/AurelianSpodarec/lovetocodefinal
This is the website code if anything: https://github.com/AurelianSpodarec/lovetocodefinal
PS,没有WordPress API或类似的东西,但是就像我上面写的那样.
PS, no WordPress API or any stuff like that, but just as I wrote above.
推荐答案
我找到了解决方案.
很简单.您需要编译所有内容并将其放入WordPress将使用的文件夹中,并进行WordPress魔术处理以获取具有功能的样式.
It's simple. You need to compile everything and put it in the folders that will be used by WordPress and do WordPress magic to get the styles with functions.
我在这里进行了此操作: https://github.com/AurelianSpodarec /Webpack-to-WordPress-Starting-Template
I have made this here: https://github.com/AurelianSpodarec/Webpack-to-WordPress-Starting-Template
这并不完美,但是对于那些希望将Webpack与WordPress结合使用的人来说是一个很好的起点.
It's not perfect, but a good starting point for those who are looking on using Webpack with WordPress.
这篇关于如何将WordPress集成到Webpack中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!