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

@fahmiirsyadk/dust

v0.2.8

Published

static site generator with [Ocaml Syntax]-to-HTML based on rescript ( WIP )

Downloads

27

Readme

Dust

Dust logo as desert emoji

small static site generator with ( ocaml 🐫 / reasonml / rescript ) syntax


Table Of Contents

Introduction

Dust is a static site generator for hardcore ppl, that use ocaml 🐫 syntax as the template engine and transform it into static HTML; inspired from Halogen. Dust use Rescript as compiler, so you can use Rescript API like Js, Belt, Array, List also Node module & etc.

Benefit using Dust:

  • Functional approach, Safe & Expressive. If you write wrong code, it will give you nice feedback (thanks Rescript). Also you can use looping, pattern matching or whatever like normal ocaml code (except u can't use ocaml packages, ofc).

example

module H = Dust.Html.Elements
module A = Dust.Html.Attributes

let head appname = 
  H.head [] [
    H.title [] (H.text appname)
  ]

(** Js code executed in compile time not runtime*)
let year = 
  Js.Date.now () 
  |> Js.Date.fromFloat 
  |> Js.Date.getFullYear 
  |> Js.Float.toString

let body = 
  H.body [] [
    H.h1 [] (H.text "Last this page rendered is: " ^ year)
  ]

(** main function is important to render the code into HTML *)
let main () =
  H.html [] [
    head "this is head title"
  ; body
  ; H.footer [] [
      H.span [] (H.text year)
    ]
  ]

Installation

Initialize project

# create project folder
mkdir yourapp
cd yourapp

# init with npm
npm init -y

# init with yarn
yarn init -y

Install Dependencies

# using npm
npm install rescript --save-dev
npm install @fahmiirsyadk/dust

# using yarn
yarn add -D rescript
yarn add @fahmiirsyadk/dust

Configuration

Configure bsconfig.json

Create a file named bsconfig.json in your project folder & paste code below, also change the name

{
  "name": "yourapp",
  "version": "0.0.1",
  "sources": [
    {
      "dir": "src",
      "subdirs": true
    }
  ],
  "package-specs": {
    "module": "commonjs",
    "in-source": true
  },
  "suffix": ".js",
  "bs-dependencies": [
    "@fahmiirsyadk/dust"
  ],
  "warnings": {
    "error": "+101"
  }
}

Configure run scripts

Open package.json & add script below to run dust

"scripts": {
  "dev": "npx dust w", 
  "build": "npx dust",
  "re:dev": "rescript build -w",
  "re:clean": "rescript clean",
  "re:build": "rescript",
  "export": "rescript && npx dust"
}

Documentation