0.0.40 • Published 1 month ago

@sweatpants/libra v0.0.40

Weekly downloads
-
License
MIT
Repository
-
Last release
1 month ago

Libra

Libra is a barebones, no-frills React component dev environment.

Installing

npm i @sweatpants/libra --save-dev

If you are using TypeScript, add @sweatpants/libra to your types field, and make sure to include libra files.

{
  "compilerOptions": {
    "types": ["@sweatpants/libra"]
  },
  "include": ["src/**/*.libra.tsx"]
}

Creating an entry

Create a new file with a name matches *.libra.{tsx,jsx}.

// MyComponent.libra.tsx
import { MyComponent } from './MyComponent';

directory('My Component', () => {
  add('Default', () => {
    return <MyComponent />;
  });
});

Running Libra

Add these two scripts to run libra in your package.json file.

"scripts": {
  "start:libra": "libra start",
  "build:libra": "libra build"
}

Configuring Libra

Create a libra.config.ts file at the root of your project

import { defineConfig } from '@sweatpants/libra/config';

export default defineConfig({
  title: 'Example Title',
  port: 8080
});

Config Options

title?: string

Sets the page title. Defaults to "Libra".

port?: number

Sets the port to run the local development server with libra start. Defaults to 9000.

open?: boolean

Opens a browser window when running the local development server with libra start. Defaults to false.

inspect?: boolean

Enables vite-plugin-inspect.

layout?: string

Specifies the file path to a custom layout for all Libra component pages.

Example layout file:

import type { LibraLayout } from '@sweatpants/libra';

const Layout: LibraLayout = ({ children, scheme }) => {
  if (!children) {
    return <>This will render on the home page when no entry is active.</>;
  }

  return <>{children}</>;
};

export default Layout;

outDir?: string

Sets the output directory for libra build. Defaults to "dist/libra".

viteConfig?: () => UserConfig

Used to modify Vite's config.

0.0.40

1 month ago

0.0.39

2 months ago

0.0.37

4 months ago

0.0.38

4 months ago

0.0.35

5 months ago

0.0.36

5 months ago

0.0.34

5 months ago

0.0.33

6 months ago

0.0.32

6 months ago

0.0.31

6 months ago

0.0.31-preview.4

6 months ago

0.0.31-preview.3

6 months ago

0.0.31-preview.2

6 months ago

0.0.31-preview.1

6 months ago

0.0.31-preview

6 months ago

0.0.30

6 months ago

0.0.29

8 months ago

0.0.28

8 months ago

0.0.27

8 months ago

0.0.26

8 months ago

0.0.25

8 months ago

0.0.24

8 months ago

0.0.23

8 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.20

8 months ago

0.0.18

9 months ago

0.0.17

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago