![]() Ideally you should install wp-env globally, because then you’ll have it available everywhere on your development machine for any project that you want to use it with. You can install it either locally to your project, or globally. So once you have Docker and Node/NPM in place, you can install wp-env. If you don’t already have Node/NPM installed head over there and follow the installation instructions. In fact, everything you do with wp-env, you’ll do from the command line. Node is how you install wp-env, and NPM is how you run it. See the instructions for installing Docker Desktop on Windows, macOS, and Linux. The easiest way to get set up with Docker is to install Docker Desktop. So the next time you you spin up wp-env, all your posts, pages, and other content will be right where you left them. The container also enables the application state to persist across instances of the application. This distinguishes wp-env from the other environments mentioned earlier which are not isolated in this way. Putting your installation into a container isolates it from other processes on your machine. wp-env requires Dockerĭocker is used to package the WordPress installation that wp-env creates into a sandboxed process known as a container, which is a virtualized application consisting of a web server, a database, and WordPress itself. But hold on, there’s a couple of prerequisites. This means that other developers collaborating on the project can clone it and spin up an identical environment. It’s an extremely convenient way of getting a WordPress installation up and running quickly and easily so that you can get on with the business of developing your new project.Īs you’ll see a little later on, wp-env can also be included as a dev dependency in your project. Gutenberg contributors developed wp-env to aid developers in creating blocks and contributing to Gutenberg, but it can be used for any plugin or theme project. Wp-env enables you to quickly spin up an almost instant WordPress environment from the command line, from whichever directory your project happens to be in, with zero configuration. ![]() So what do you do if, like me, you you don’t want to have to set up a whole new WordPress installation for every idea you want to experiment with? And moreover, if you would rather keep all your development projects in a single, easy-to-back-up /Development directory? Introducing wp-env Yes, it is possible to develop in another location, but then you then need to create a symlink in wp-content/themes or wp-content/plugins that points to the directory you’re developing in. (Maybe you should have started by writing down that brilliant idea in a notes app! □)Īnother disadvantage of both Local and MAMP/WAMP/XAMPP, and also of the other environments you might use, like Laravel Valet, DevKinsta, and the now sadly defunct DesktopServer, is that they all make you build your theme or plugin in the wp-content directory of your local WordPress installation. and laboriously configure the WordPress files.įurthermore, if you need to host several sites locally you may also have to set up separate virtual hosts in Apache.And then, every time you want a new WordPress site, you have to: MAMP is a little easier, since the Mac operating system comes with PHP and Apache. WAMP and XAMPP require you to install Apache, PHP, and MySQL/MariaDB separately. ![]() MAMP/WAMP/XAMPP, on the other hand, is at the other end of the scale. You only need to install it once and after that, you have a short and painless path to an up-and-running WordPress installation, though you do still have to launch the app first whenever you want a development environment. ![]() ![]() So how fast can you get coding with the local-development options that are out there now? Instead they’re things that hold you back, albeit temporarily, when what you really want to do is Just! Get! Coding! Local-dev options you’ve probably heard of Depending on your local environment, that process can involve a variety of steps:Īll of these things can be rather tiresome and none of them involve actually working on coding up your idea. The last thing you want to do is waste your time and creative energy setting up a new local WordPress instance. Sometimes you get a great idea, one that is so compelling that you really want to try it out right now! And since you’re a WordPress developer, that means you want to start coding up a quick proof of concept straight away. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |