npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@le-static/loader

v1.0.1

Published

Loads a project folders and it's config.

Downloads

7

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. 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.

{
    "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).