VS Code Live Server not working

Hi Trying to use VS Code Live Server, I’ve installed the extension. In the address bar I’ve entered: http://127.0.0.1:5500/plainkit-master/site/templates/oil-paintings/
I receive:
Cannot GET /plainkit-master/site/templates/oil-paintings/

In XAMPP http://localhost/plainkit-master/oil-paintings/ works fine.

What am i doing wrong?
Thanks for any help

No change - I tried

http://127.0.0.1:5500/plainkit-master/oil-paintings/

and get: Cannot GET /plainkit-master/oil-paintings/

The path I used in the original url was the actual path structure.

What exactly have you installed? Keep in mind that you need either the Firefox or Chrome browser extensions to make this plugin (if that’s the one you mean) work with dynamic sites. You also need to run a local server.

Hi,

I think the problem is the page is composed of alot of modules - templates, snippets ect. so making changes in any of these changes the browser preview - and I’m not clear what the url should be. As I said in xampp the url is: http://localhost/plainkit-master/oil-paintings/ which transforms to http://localhost/plainkit-master/oil-paintings/oil-miniture-1

but the actual path is: plainkit-master\site\templaites\oil-paintings

I’m trying both in vsCode and Atom but so far no luck in bringing up a preview as I edit.

All examples use index.html, but in Kirby I don’t have an index.html, so how do I see a browser preview.

Thanks for any help

As I said, you need an additional browser extension to make the plugin work with PHP.

@mdavid This is really outside Kirby support. If the above doesn’t help you, please read the plugin documentation and the documentation for the browser extension carefully.

Hi Sonja, Really appreciate you taking the time to do this demo.

Seems I have other issues - “127.0.0.1 refused to connect.” Which I’ll sort.

Do have one question, you said “you need an additional browser extension to make the plugin work with PHP” is that in addition to Live Server, if so what?

Thanks for your time

David

The VS Code Live Server plugin only works with HTML files , that is what I was trying to say from the beginning. You need this browser extensions (available for Firefox and Chrome: https://github.com/ritwickdey/live-server-web-extension)

In the readme you will find the store links for the browser extensions as well as the setup tutorial. As you can see in my GIF, you have to call your original localhost server address in the browser after setting up the matching live server address in the browser extension settings.

In my example, the live server address is http://127.0.0.1:5501, while my Kirby project is by default available at http://325.test (I’m using Laravel Valet, so each project in my public_html folder is automatically available under foldername.test. In your setup, you would stick with http://localhost/plainkit-master.

A post was merged into an existing topic: VS code live server doesn’t work

The way I “fixed” it was really simple.

I’ve had this issues for months and only realized today that it only works with folders (or maybe that’s just me, i don’t know)

So try this:

  1. Create a new folder in VS Code and create/put your files in that or just create a folder in your file explorer on your laptop/PC and open that in VS Code
  2. Right-click on the file you want to open in the browser and choose Open with Live Server, or use the shortcut Alt + L and then Alt + O to open it in a liver sever.

That’s it!

PS - I put fixed in quotation marks because I didn’t really fix anything, I just realized the error popping up on my screen wasn’t actually difficult to follow, I just assumed it was because I was new to programming.

1 Like

So i came up with all the solutions for what the live server won’t work

  1. After installing reload the VS code or close and open it.
  2. Before starting the live server make sure all your HTML and css or scss files are placed in one complete folder and open that folder in VS code and run live server.
  3. Turn on auto save . Go to->file->auto save . Make sure in has tick mark
  4. Don’t name your folder starting with # //This is important

so all set it should work perfectly.
Keep your browsers updated.

1 Like

Great! Thanks for sharing; I’m new to programming too and wasn’t understanding what was going wrong neither. It worked. :raised_hands:

Thanks! This worked for me. I didn’t realize I had to turn on the auto save first.