sorvor

command module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 11 Imported by: 0

README

sørvør

extremely fast, zero config server for modern web applications.

✨ Features

  • HTML EntryPoint - use src/index.html as an entry point for an application.
  • SPA Routing - redirects path requests to src/index.html for frontend routing.
  • Asset Pipeline - great asset processing with simple primitives.
  • Live Reloading - reload browsers on code change.
💪 Powered By
  • esbuild - an extremely fast JavaScript bundler.
  • golang - an expressive, concise, clean, and efficient programming language.

⚡ Installation

Use go binaries to install sørvør:

curl -sf https://gobinaries.com/osdevisnot/sorvor | sh

Alternatively, if you have go installed, use go get to install sørvør:

go get github.com/osdevisnot/sorvor

🍽 Usage

You can use sørvør as a local development server or as a build tool. By default, the sørvør command will build your project and exit. To start a local development server, pass --dev as a command line argument.

sorvor --dev

😎 Asset Pipeline

sørvør provides great asset pipeline with simple primitives.

Build JS or CSS with esbuild

To run entry points from src/index.html through esbuild, use esbuild function in the index file

Example:

<script type="module" src="{{ esbuild "index.js" }}"></script>

This will bundle index.js file and serve the build output on local development server.

Enable Livereload

To enable livereload functionality, use livereload function in the index file

Example:

<script>{{ livereload }}</script>

💢 Configuration

For most part, sørvør tries to use sensible defaults, but you can configure the behaviour using command line arguments below:

cli argument description default value
--src=... source directory for sørvør src
--port=... port for sørvør 1234
--dev enable development mode false

sørvør forwards all the other command line arguments to esbuild. Please refer documentation for simple esbuild options or advance options to further customize the bundling process.

For example, to use esbuild with modern esm format, use a command like this:

sorvor --format=esm --dev

sørvør configures below values for esbuild as defaults:

cli argument description default value
--bundle enables bundling output files true
--write enables writing built output to disk true
--port=... port to start esbuild in serve mode 1234 (if --dev mode is enabled)
--outdir=... target directory for esbuild output dist

🐣 Motivations/Inspirations

sørvør started with desire to simplify frontend tooling, with strong focus on speed of execution. It uses esbuild for bundling modern javascript and typescript syntax to a lower target. The idea here is to implement features that esbuild deems as out of scope, but are necessary for decent development environment.

This project is inspired by servør from Luke Jackson, which provides similar zero dependency development experience but lacks integration with bundler/build tools. I choose golang to implement this project to solidify my learning of the language and to achieve a zero dependency model.

🔬 Roadmap

This project currently lacks many features already available in servør, some of which will be implemented in the future. The idea is to try to achieve feature parity with servør, for features that are most essential.

I want to avoid implementing features that are already on roadmap for esbuild. The idea is to use esbuild as is without duplicating efforts.

🥂 License

sørvør is licensed under the MIT License.

Documentation is licensed under Creative Commons License.

Created with ❤️ by @osdevisnot and all contributors.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL