Coder Social home page Coder Social logo

hypha-beaker's Introduction

Hypha/Beaker Browser Example

An experimental single-page-app style site generator for Beaker Browser using Hypha and Choo.

Usage

I want my sites to be simple. Just a bunch of plain text files. I want to turn those files into a site without having to deal with a server, or apis, or build processes. I want it to be a calm thing. I want to share my site peer-to-peer and not depend on a centralized hosting platform. This is a stab at that.

  • Format a directory of content as described in the Hypha documentation.
  • A Choo app renders your /content, as defined by source in /site

Installation

  • Clone the archive into an empty Dat
  • Run npm install inside /site to install the dependencies
  • Run npm build to build the source

Of course, you can also just go ahead and clone the Dat archive to get all the bundled files.

dat://5b269ae56e15bd3b22c19a382c92be96bc427888f57576609477d95dc9f5796e/

Development

  • Run npm start to watch for changes to your site’s source during dev.
  • Run npm run build to build your site!

Views

Creating a view involves placing a js file in the site/views directory. This requires some manual configuration. An example of a minimal view:

var html = require('choo/html')

module.exports = function example (state, emit) {
  return html`
    <div>
      ${state.page.title}
    </div>
  `
}

We’ll save this as example.js. Next, add the view to site/views/index.js:

module.exports = {
  default: require('./default'),
  example: require('./example')
}

To access the view from within one of our pages, add a view field to the index.txt file:

title: Example Page
----
view: example

You can see how this can easily be extended to exposing any number of options by using the value of a field to select a key within an object in your build.

For a more comprehensive unpacking of how this works, take a look at the information page.

Notes

  • If cloning into a Dat archive within Beaker, ensure you edit your dat.json file to include { "fallback_page": "index.html" }. This will be fixed in an upcoming version of Beaker.

Todo

  • Add a better non-p2p page
  • Typography credit (info page?)
  • Use the Enoki Panel in /panel

hypha-beaker's People

Contributors

jondashkyle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.