@leiops/tinyapp

1.2.1 • Public • Published

@leiops/tinyapp

npm npm npm

A tool for generating trivial, single-document React apps.

We typically use this tool for generating simple docs applications.

Simple Usage

const path = require('path')
const tinyapp = require('@leiops/tinyapp')

tinyapp({
    from: path.resolve(__dirname, './DocsApp.jsx'),
    to: path.resolve(__dirname, './docs/index.html'),
    title: 'Icons',
})

Because Tinyapp does not allow you to provide your own HTML document, it exposes the MOUNT_NODE global variable for use with ReactDom.render.

Your entry file might look something like this:

import './styles.scss'
import App from './App.jsx'
import React from 'react'
import ReactDom from 'react-dom'

ReactDom.render(
    <App />,
    MOUNT_NODE
)

MOUNT_NODE is an alias for document.getElementById("mount-node") - so expect a root div with the id "mount-node" in your final app.

Tinyapp can process React JSX, ES7 JavaScript, CSS, SCSS, and SASS files.

API

tinyapp(options)

Writes the given application to the specified destination, returns undefined.

options
    from: required String - path to react app to compile
    to: required String - destination path
    title: String - the document title

Package Sidebar

Install

npm i @leiops/tinyapp

Weekly Downloads

0

Version

1.2.1

License

MIT

Unpacked Size

773 kB

Total Files

13

Last publish

Collaborators

  • gnordhielm