Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

nedpals/sulatcms

Repository files navigation

ATTENTION: This is currently in development. Please wait for the stable release. You are looking for the next version of SulatCMS currently developed right now.

SulatCMS Maintainability

Simple plugin-driven Headless CMS for JAMstack sites.

Features

  1. Platform-agnostic - Edit your markdown posts from your local filesystem, git, WordPress, and etc.
  2. Plugin-driven - From content manipulation to publishing your content, they are all handled by plugins.
  3. Barebones - A Sulat installation with no plugins only weighs about 60kb compared to previous version.
  4. Powered by Mithril - A tiny, complete out-of-the box Javascript library makes Sulat slim and fast.

Install

To start, install Sulat via NPM/Yarn or

yarn add https://github.com/nedpals/sulatcms#next

or you can embed it directly

<!-- Place the javascript file before the <body> closing tag -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/nedpals/sulatcms@next/dist/sulat.js">

Usage

To get started, initialize first the CMS by invoking the initialize function. If you are setting up in the browser without any build tools, you can access it through window.sulat.

sulatcms.initialize({
    el: document.getElementById("sulat"),
    auth: "netlify", // if you are using authentication, you need to set the default provider.
    plugins: [
        //... plugins goes here.
        netlifyIdentityPlugin(),
        gitlabPlugin()
    ]
})

Once you set up and install all the plugins, you're good to go!

Plugins

What makes SulatCMS unique is the first-class support of plugins. Plugins what makes the CMS functionable from content management to authentication.

Creating a plugin

SulatCMS plugins are just regular functions returning a single plugin object. The plugin object contains metadata for the plugin (name and etc.) as well as it's event functions both for the CMS and authentication management.

function myFirstPlugin(options) {
    return {
        name: "my-first-plugin",
        events: {
            onInit() {
                console.log("Hello " + options.name);
            }
        }
    };
}

Using the plugin

You can simply add the plugin to the CMS's config:

initialize({
    // ...
    plugins: [myFirstPlugin({
        name: "Bob"
    })]
    //...
})

As soon as the as the CMS is loaded, the plugins are automatically loaded. In this case, our plugin executes after the CMS has been fully loaded.

Development Notes

  • Plugin system now implemented. I'm gonna think first what set of APIs will be implemented.

Pre-launch plans

  • Make Github and Gitlab as default platforms
    • Note: Login only works on Netlify sites. Still working on making it usable for non-Netlify sites.
  • ~~Implement few API's for plugins~
  • Cleanup the UI
  • Target file size should be atleast between 100-300kb

Contribute

To start:

$ npm install

To develop:

$ npm run dev

To build for production:

$ npm run build

© 2018 nedpals.

Releases

No releases published

Packages

No packages published