# @le-static/loader

> Loads a project folders and it's config.

Latest version **1.0.1** (published 2023-11-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @le-static/loader
pnpm add @le-static/loader
yarn add @le-static/loader
bun add @le-static/loader
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-11-14 |
| First published | 2023-11-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mathys Gasnier |
| Maintainers | mathys-gasnier |

## Links

- npm: https://www.npmjs.com/package/@le-static/loader
- Repository: https://github.com/Mathys-Gasnier/le-static
- Homepage: https://github.com/Mathys-Gasnier/le-static/tree/master/packages/loader
- Issues: https://github.com/Mathys-Gasnier/le-static/issues
- npm.io page: https://npm.io/package/@le-static/loader

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Recent versions

- 1.0.1 (latest) — 2023-11-14
- 1.0.0 — 2023-11-10

## README

# loader

Loads a project folders and it's config.

## Project loading

When used the `load()` function takes the `src` (path) of a project and returns eather a `Project` or `null`. <br>
It retuns null if the path given to the load function has no config file (`.le-static.json`).

## Config

The config is a json file `.le-static.json` that needs to be at the root of the project.
```json
{
    "server": {
        "port": 8080 // number or string, defines the server port when serving the app (default: 8080)
    },
    "site": {
        "title": "%page_name%", // string, the title of every pages on the site, %page_name% is replaced by the name of the current page (default: "%page_name%")
        "favicon": "" // string, the favicon of the site (default: None)
    },
    "build": {
        "outDir": "dist", // string, the folder where the builder will output the built project (default: "dist")
        "components": {
            "prefix": "", // string, component added before each page content (default: None)
            "suffix": "" // string, component added after each page content (default: None)
        }
    }
}
```

## Project Structure

A project is defined by the config file but also by a number of folders:
- `pages/` - It contains every pages of the site, routes are defined with the folder structure and index.md files are served on folder access.
- `components/` - It contains the components that you can import in the pages, you can import components in components.
- `styles/` - It contains the styles that you can use across your pages and components.
- `resources/` - It's the folder you use to store images and anything that doesn't fit in another folder.
- `templates/` - It contains the templates that can be used in pages

## Folder

Every folder has a `name` and a `files` object. It contains key value pairs to every sub files or folders.

## File

A file stores it's `name`, `extention` and `content` eather as a string or as a Buffer (for images).

---
_Source: https://npm.io/package/@le-static/loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
