Giter Site home page Giter Site logo

molnarmark / sublime-live-server Goto Github PK

View Code? Open in Web Editor NEW
64.0 3.0 8.0 74 KB

๐ŸŒ๏ธ Launch a Development Server directly from Sublime Text

Home Page: https://github.com/molnarmark/sublime-live-server

License: MIT License

Python 100.00%
sublime sublime-text sublime-text-3 live-server sublime-server sublime-package sublime-text-plugin sublime-plugin

sublime-live-server's Introduction

Launch a Development Server directly from Sublime Text!

๐Ÿ“‹ Introduction

This package integrates the Live Server Node package, giving the ability to launch a local development server to serve content directly from Sublime Text.

๐Ÿ’ก About Live Server:

Live Server is Node.js tool that spins up a local development server in the given directory.

It features live browser reloading, which simply means that your browser will automatically refresh the page when any change is made to your HTML & CSS files.

Useful for static sites, SPAs, and general HTML/CSS fiddling.

โ—Prerequisites

You need the following software installed to use Live Server.

To install Live Server globally using npm, run:

npm install -g live-server

To install Live Server globally using Yarn, run:

yarn global add live-server

๐ŸŒ€ Installation

Package Control

This package is available in Package Control under the name LiveServer.

As a Repository

โ“ Usage

This package exposes 3 commands that can be used directly via the Command Palette, or bound to keys. These are:

Live Server: Start

  • Maps to live_server_start

Live Server: Stop

  • Maps to live_server_stop

Live Server: Open In Browser

  • Maps to live_server_open_in_browser

Status bar messages with indicator emojis are implemented into the package, displaying information in cases such as:

  • ๐ŸŽ‰ Live Server running
  • โŒ Live Server stopped
  • โœ”๏ธ Live Server status

When the development server is running, a status message will be shown in the status bar indicating that the server is running. This is shared across all views in the opened instance.

๐Ÿ”จ Settings

To change your settings, bring up the Command Palette and select: Preferences: Live Server Settings

The default settings are the following:

// Note: These are just mappings to https://github.com/tapio/live-server#usage-from-command-line
{
  "node_executable_path": "/usr/bin/node",
  "global_node_modules_path": "/usr/local/lib/node_modules",
  "port": 8080,
  "address": "localhost",
  "cors": true,
  "browser": "default",
  "nobrowser": false,
  "wait": 100
}

node_executable_path

  • Path to the Node runtime executable. You can run whereis node in your terminal to find this.
  • default: /usr/bin/node

global_node_modules_path

  • Path to the default node_modules directory. You can run npm root -g or yarn global bin in your terminal to find this.
  • default: /usr/local/lib/node_modules

port

  • The default port for the server.
  • default: 8080

address

  • Host address. This should always be either localhost or 127.0.0.1.
  • default: localhost

cors

  • Enables CORS for any origin.
  • default: true

browser

  • Specifies which browser to use.

  • Valid values are:

    • default
    • google-chrome
    • firefox
  • default: default

nobrowser

  • By setting this to true, the browser will not open the server by default
  • default: false

wait

  • Wait this amount of milliseconds before reloading the page after a change
  • default: 100

๐Ÿ”– Credits

sublime-live-server's People

Contributors

hansanonymous avatar molnarmark 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

Watchers

 avatar  avatar  avatar

sublime-live-server's Issues

live-server doesnt work on arch linux, solved

bad config on global node modules

the problem is that I installed it with yarn, and the server would not start, then I checked,
"global_node_modules_path" and found the problem, it was that the default path did not match my yarn path, which is in

"/home/work/.config/yarn/global/node_modules/", at least on my pc

, and when I change it to this one, the server worked, I hope this can be put in the readme.md as problems to help another one, well the server is now doing great.

Localhost Refused to Connect

I've setted all the paths correctly, as you can see below.

{ "node_executable_path": "C:/Program Files/nodejs/node.exe", "global_node_modules_path": "C:/Users/(My user)/AppData/Roaming/npm/node_modules" }

And it shows the "Live Server running on port 8080" message. The problem comes when trying to run the Open in Browser command, as it shows Localhost refused to connect.

I've seen that another user had the same problem before, but I can't find a way to fix it. Running on Windows 10, using the latest version of Sublime Text, the package seems to be the latest, but even if all looks right, this is what I get. (It is on spanish, but I think I've been clear enough)
image

It just doesn't work

After install the package, I find after enter the live server: start, it doesn't work.

How can I open a file directly

Is there any way to make it open the file directly instead of opening the folder and then selecting the file to open afterwards๏ผŸ

Opening in non default browser

I have few browsers installed:
Firefox
Firefox Developer Edition
Firefox Nightly
Google Chrome
Google Chrome Dev

Firefox is my default browser, but for dev I would prefer use Firefox Developer Edition or Google Chrome Dev, but I don't know what I should put instead of "default", I tried few things like:
"browser": "firefox",
"browser": "firefox dev",
"browser": "firefox-dev",
"browser": "firefox developer",
"browser": "firefox-developer",
"browser": "mozilla-firefox-developer",
Even "google-chrome" doesn't work. I always have "Windows cannot find 'xxxxxxxxxxx'. Make sure you've typed the name correctly, then try again." So how can I open live server in non default browser?

Not refreshing after saving file

I've got Live server running in Sublime, but nothing happens in the browser when I save a file. I have to manually refresh the browser to see my changes. Any ideas?

It's not working on my sublime text

I have live server installed on sublime text 3 and also node.js, npm and live server installed globally on my pc. But live server doesn't start and in the console it writes "FileNotFoundError: [WinError 2] The system cannot find the file specified". I don't know what I'm doing wrong, could anyone please help me? Below is the complete code in console.

Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
return self.run(edit)
File "C:\Users\Other Users\AppData\Roaming\Sublime Text 3\Installed Packages\LiveServer.sublime-package\plugin.py", line 59, in run
File "./python3.3/subprocess.py", line 819, in init
File "./python3.3/subprocess.py", line 1110, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

custom port in settings doesnt work

it was working on 8080, but its used by another server of mine.
i've set up the port to 4444 or 3434 but it didnt work. live-server started but i couldnt connect in browser.

Unable to use live server

Sublime text shows the live server command palette but does not do anything if I hit start or stop.

I am on mac and new to programming, so I could not clean up the npm audit. If I even need to.

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.