Giter VIP home page Giter VIP logo

live-server.nvim's Introduction

live-server.nvim

Live reload HTML, CSS, and JavaScript files inside neovim with the power of live-server.

Installation

  1. Install live-server globally with your node.js package manager of choice.

  2. Install regularly with your neovim package manager

For example, a config with pnpm and lazy.nvim may look like the following:

require('lazy').setup {
    {
        'barrett-ruth/live-server.nvim',
        build = 'pnpm add -g live-server',
        cmd = { 'LiveServerStart', 'LiveServerStop' },
        config = true
    }
}

Configuration

Configure via the setup function (or use the defaults with no arguments):

require('live-server').setup(opts)

See :h live-server for more information

Usage

:LiveServerStart: start the live server

:LiveServerStop: stop the live server

Acknowledgements

  1. mazeloth/live-server: the first ever live-server port to vim
  2. aurum77/live-server.nvim: the first live-server port to neovim (however, it unecessarily depends on npm and didn't quite cut it for me)

live-server.nvim's People

Contributors

barrett-ruth avatar iamgideonidoko avatar mathstylish avatar mrcapivaro avatar oeyoews avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

live-server.nvim's Issues

:LiveServerStart Freezes Neovim

I believe that I have the correct setup from the docs. I am using Lazy and Bun though. This is my setup:

{
  "barrett-ruth/live-server.nvim",
  build = { "bun add -g [email protected]" },
  cmd = { "LiveServerStart", "LiveServerStop" },
  config = true,
},

Some more context: I can run live-server . in my project dir and live-server will start or i can run bunx live-server . in my project dir which will also start live-server. The reason for 1.2.1 is because of an issue with Live Server and Linux on the latest version. I have run :checkhealth and everything seems fine as far as I can tell. However, if i run the command, :LiveServerStart within Neovim, it will freeze and become unresponsive so I need to close and reopen it.

I have a feeling I maybe reconfigured something and I don't see it. TIA!

Bug Report

Info

  • Operating System: Ubuntu
  • nvim --version: v.0.11.0
  • Node package manager: v21.7.3
  • <node-package-manager> --version: v21.7.3
  • live-server --version: 1.2.2

Configuration

return {
'barrett-ruth/live-server.nvim',
build = 'pnpm add -g live-server',
cmd = { 'LiveServerStart', 'LiveServerStop' },
config = true
}

require('nvim-package-manager').setup {
    -- Any special plugin config
    {
        'barrett-ruth/live-server.nvim',
    }
}

Description

When I run :LiveServerStart command in neovim it is giving me error:

Cannot GET /

Not working in window's

Info

  • Operating System: window 11
  • nvim : 0.9.1
  • node -v = v20.3.0
  • live-server --version: 1.2.2

Configuration

default for liveserver.nvim

LAZY

require('lazy').setup {
    {
        'barrett-ruth/live-server.nvim',
        build = 'yarn global add live-server',
        config = true
    },
}

Description

when running :liveserverstart neoivm just freezez heck it freezes whole terminal
image

How can I serve a directory from its absolute path

Hello,
I must be missing something obvious but I cannot manage to serve a given directory.
I tried passing --open= and/or --watch= in args but that's not working, that makes sense because on the command line it's not working either

My config is the following

 local config = function()                                                                           
   require('lazy').setup({})                                                                         
   require('live-server').setup({                                                                                        
     args = { '--port=0', '--browser=firefox', '--htpasswd=/home/statquant/.live_server_pwd.txt', '/home/statquant/Work' }
   })                                                                                                
 end                                                                                                 
                                                                                                     
 return {                                                                                            
   'barrett-ruth/live-server.nvim',                                                                  
   laxy = false,                                                                                     
   -- build = 'pnpm add -g live-server',                                                             
   cmd = { 'LiveServerStart', 'LiveServerStop' },                                                    
   config = config,                                                                                  
   enabled = true,                                                                                   
 }                                                                                                   

Say I want to serve /home/statquant, how should I proceed ?

[Bug] can't handle relative path properly

Info

  • Operating System: Mac OS
  • nvim --version: 0.9.4
  • Node package manager: v21.5.0
  • <node-package-manager> --version: 10.2.4
  • live-server --version: live-server 1.2.2

Configuration

use lazy and just use config = true

    { "barrett-ruth/live-server.nvim", build = "npm install -g live-server", config = true },

Description

import { App } from "./App.js";
import { createApp } from "../../lib/miniVue.esm.js";

I am sure that miniVue.esm.js is exist and can use gf to jump to this file, however, browser report that

GET http://127.0.0.1:8080/lib/miniVue.esm.js net::ERR_ABORTED 404 (Not Found)

the same plugin in vscode is work properly, so I guess it is a bug of this plugin

live-server not reloading browser

Info

I downloaded live-server for nvim with lazy. also globally with npm. It works when running LiveServerStart, but saved changes are not reloaded in the browser. I have to manually reload the browser to see the changes.

  • Operating System: Ubuntu22.04
  • nvim --version: v0.9.4
  • Node package manager:
  • <node-package-manager> --version: nvm 0.38.0
  • live-server --version: 1.2.2

Configuration

this is my config located in custom.plugins.lua (I'm using nvchad distro of nvim):

{
        "barrett-ruth/live-server.nvim",
        build = "npm install -g live-server",
        event={"BufReadPre", "BufNewFile"}, --this is for initiate live-server in new buffer
        config=true,
     },
this is what console in browser shows: `Live reload enabled.`

Description

Another thing i noticed, is when running LiveServerStop, i got this message: live-server.nvim: stopped with code 143
Even If I don't make any change to the html file, i got that message when running LiveServerStop.

This is my html file if it is important

<!DOCTYPE html>
<html lang="en">
     <head>
          <title></title>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1">
          <!-- <link href="css/style.css" rel="stylesheet"> -->
     </head>
     <body>
          <h1>Hi</h1> 
     </body>
</html>

It was working very well before, I don't know what happened :'/

LiveServerToggle command not working

I was trying to implement a keymap for starting and stopping live server when I stumbled upon the LiveServerToggle command, but on trying it out, it isn't working. Is there a way around this?

Blank Screen?

So I managed to install the plugin properly using Packer โ€” but when I ran :LiveServerStart inside my directory it started the server but didn't show the index.html file, am I missing something obvious?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.