如何将 WordPress 集成到 Webpack 中? [英] How to integrate WordPress into Webpack?

查看:32
本文介绍了如何将 WordPress 集成到 Webpack 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 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

它并不完美,但对于那些希望将 Webpack 与 WordPress 一起使用的人来说,这是一个很好的起点.

It's not perfect, but a good starting point for those who are looking on using Webpack with WordPress.

这篇关于如何将 WordPress 集成到 Webpack 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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