All Projects → kodedninja → nanoconstruct

kodedninja / nanoconstruct

Licence: other
Tiny tool to test and develop nanocomponents

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to nanoconstruct

component-box
A little component cacher 📦
Stars: ✭ 25 (+108.33%)
Mutual labels:  choo, nanocomponent
olaf
A P2P chat using Dat.
Stars: ✭ 24 (+100%)
Mutual labels:  choo
hyperscript-attribute-to-property
Convert hyperscript attributes to properties
Stars: ✭ 19 (+58.33%)
Mutual labels:  choo
choo-test
🚂🚋🚋🚋 Easy choo app unit testing
Stars: ✭ 23 (+91.67%)
Mutual labels:  choo
stream
Monorepo for Resonate Coop player
Stars: ✭ 164 (+1266.67%)
Mutual labels:  choo
Choo
🚂🚋 - sturdy 4kb frontend framework
Stars: ✭ 6,637 (+55208.33%)
Mutual labels:  choo
choo-pwa
PWA with Choo
Stars: ✭ 18 (+50%)
Mutual labels:  choo
cache-component
DEPRECATED: Use nanocomponent. Will continue to operate as normal
Stars: ✭ 16 (+33.33%)
Mutual labels:  choo
choo-offline
🔧 offline first support for choo apps
Stars: ✭ 12 (+0%)
Mutual labels:  choo
awesome-yo-yo
Modules & resources related to yo-yo
Stars: ✭ 27 (+125%)
Mutual labels:  choo
monolazy
Extended nanocomponent providing onEnter callback
Stars: ✭ 21 (+75%)
Mutual labels:  nanocomponent

nanoconstruct

Stability NPM version

Tiny tool to test and develop nanocomponents.

nanoconstruct provides a very simple wrapper around your components and serves them on a simple interface you can access with your browser. It's inspired by Kit and uses budo under the hood.

It includes choo-devtools, so you have access to the state and other Choo things, and tape for testing.

Demo of nanoconstruct

Installation

npm i nanoconstruct

Usage

If your component depends on a custom state or parameters, you can wrap it into a simple wrapper function. Otherwise, a neutral wrapper will be used around the component.

A simple wrapper function looks like this:

var html = require('choo/html')
var Component = require('./components/component')

var c = new Component()

module.exports = () => html`${c.render()}`

Then just point nanoconstruct to the file with:

nanoconstruct example.js

Multiple Components

It's also possible to use your whole component library at once. Use the --library mode and point nanoconstruct to a directory of wrapper functions or components.

However, if the structure of your components isn't that simple, export all the wrappers or components from a .js file and use this as input.

Like this:

module.exports = {
  Title: require('./title-wrapper'),
  Content: require('./component/content')
}

CLI

usage
  nanoconstruct [opts] <entry>
options
  --help, -h              show this help text
  --library, -l           use all the files from a library
  --open, -o              open the page in the browser
  --port, -p              server port
  --version, -v           print version
examples
  start server
  nanoconstruct example.js

  start server on port 3000 and open it
  nanoconstruct example.js -p 3000 -o

  start server with library mode
  nanoconstruct components --library
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].