1.3.0 • Published 4 years ago

@outwalk/sable v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Sable

Sable is a next generation build tool for modern JavaScript projects.

Actions License Chat Server


Installation

Install using npm:

npm install -g @outwalk/sable

Install using yarn:

yarn global add @outwalk/sable

Getting Started

Getting your project up and running with Sable only takes a few simple steps.

# Step 1 - Create a config file
sable init

# Step 2 - Compile your project
sable compile

Thats it!

Sable can be used used through its command line interface with an optional config file, or through its JavaScript API. Many config options are available to customize and extend your projects.

You can build multiple projects at once by adding another entry to the sable config file using the sable init command.


Commands

You can see a full list of commands and options available using sable --help.

# Create a new config entry
sable init

# Compile the project
sable compile <options>
sable -c <options>
sable <file> <options>
sable <options>

# Start a local web server
sable serve <options>

Sable Compiler

The Sable compiler takes in your JavaScript files and compresses them into a single application or library code bundle. Packages installed via npm can also be imported into your project and bundled or kept external.

The command for compiling is sable compile <options>, this will run the compiler once. If you want to run the compiler every time you save a file, pass the --live option to the command. To change how your code is being compiled you can pass options to it using the cli, or you can add the options in your sable.json file.

Sable determines what files to compile by using import statements. All files that are linked to your input file by import statements will be compiled.

CommonJS modules can also be imported using JavaScript Module syntax.

Example:

/* importing print from PrintFunctions.js makes the print function get bundled with your code */
import { print } from "./PrintFunctions";

print("Hello World!");

Sable Plugins

Sable is compatible with existing plugins for Rollup. you can add them to your config using the plugins option.

Example:

[{
    "input": "test.js",
    "output": "test.out.js",
    "plugins": {
        "rollup-plugin-typescript": {"target": "es5"}
    }
}]

Sable WebServer

Sable has support for building basic web servers. The easiest way to get a server up and running is to simply run the command sable serve <options>, but if you want something a little more involved, you can use the JavaScript API to create a web server.

Example:

import { serve } from "@outwalk/sable";


const options = {...};

serve(options);

Why?

Sable was developed in order to make the setup process of JavaScript projects easy and as minimal as possible. Instead of installing a bunch of plugins and writing complex configuration files, you can let Sable handle everything for you. Sable is designed to bring some similarity of native development environments to the web. Most packages on NPM use the legacy CommonJS module format, JavaScript Modules are much nicer to use and are the standard. Sable provides the ability to use JavaScript Module syntax to import legacy CommonJS modules.


Support

Having trouble with Sable? Create a new Issue or contact us on our website.


License

Sable is licensed under the terms of the MIT license.