Skip to content

Instantly Reload changes in your browser during development on a LocalWP site

Notifications You must be signed in to change notification settings

programonaut/local-addon-instant-reload-with-php

 
 

Repository files navigation

Local Instant Reload Add-on (with PHP)

A Local add on that introduces live browser reloading while developing your WordPress site. This repository hosts the source code. This fork can be used if you are developing a Tailwind CSS Website with Local WP.

Currently this add-on performs live reloading through the use of a forked version of with Browsersync.

Manual Installation & Development setup

If you haven't already, it is advised that you familiarize yourself with the basics of electron.

Clone

Clone the repository into one of the following directories depending on your platform:

  • macOS: ~/Library/Application\ Support/Local/addons
  • Windows: C:\Users\username\AppData\Roaming\Local\addons
  • Linux: ~/.config/Local/addons

You need to replace 'Local' with 'Local Beta' in the above paths if you want to create the add-on for Local Beta.

If you prefer to clone your source code elsewhere, you can do so and then symlink that directory to one in the above mentioned directories.

An example of this on MacOS would look like:

git clone git@github.com:getflywheel/local-addon-instant-reload.git ~/code

ln -s ~/code/local-addon-instant-reload ~/Library/Application\ Support/Local/addons

Install Add-on Dependencies

yarn install or npm install

Add Add-on to Local

  1. Clone repo directly into the add-ons folder (paths described above)
  2. yarn install or npm install (install dependencies)
  3. yarn build or npm run build
  4. Open Local and enable add-on

If the enabling the add-on via the Local UI doesn't work for some reason, you can also enable it by updating the file enabled-addons.json. This is located at one of the following application specific paths.

You'll want to make sure that the json file includes:

"@getflywheel/local-addon-instant-reload": true

  • macOS: ~/Library/Application\ Support/Local/enabled-addons.json
  • Linux: ~/.config/Local/enabled-addons.json
  • Windows: C:\Users\<username>\AppData\Roaming\Local\addons\enabled-addons.json

Development

External Libraries

It is worth noting the the TS definitions for this module are exposed and publicly availble. The actual code is injected once the add-on is loaded by Local. This can make writing tests a little tricky as the @getflywheel/local/<main/renderer> module isn't available outside of Local (ie testing unit testing environments). The best option is to mock out this module while running tests.

Folder Structure

All files in /src will be transpiled to /lib using TypeScript. Anything in /lib will be overwritten.

Development Workflow

For additional help getting started, you can consult the Local add-on API, which provides a wide range of values and functions for developing your add-on.

License

MIT

About

Instantly Reload changes in your browser during development on a LocalWP site

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 86.0%
  • JavaScript 8.1%
  • SCSS 5.9%