Skip to content
This repository has been archived by the owner on Nov 10, 2019. It is now read-only.
/ tram-build-page Public archive

🚡CLI and JS tool for building a single page off of a tram-one web application

Notifications You must be signed in to change notification settings

Tram-One/tram-build-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Downloads Version License

Tram-Build-Page

CLI and JS tool for building a single page off of a tram-one web application

This tool is useful if you want to pre-render a route on your index.html. This way, if javascript has been disabled, you can still have some default content.

Ideally you would use this script in a post-build step to modify your distributable's index.html.

Install

npm install tram-build-page

CLI Usage

For the CLI you can use -o to write to a specific file, or -w to write out to the console (and then pipe into another command).

tram-build-page -a './main.js' -r '/' -i './public/index.html' -o './dist/index.html'

CLI Options

Options:

    -a, --app-path <value>    Tram-One Application Path (should call .start)
    -r, --route <value>       Route to render on the Page
    -i, --index-path <value>  Relative Path to index.html file
    -h, --mock-host <value>   [optional] Mock Host to use in the url (defaults to http://localhost/)
    -o, --out-path <value>    [optional] Path to save new index.html
    -w, --write               [optional] Write out result to console
    -h, --help                output usage information

API Usuage

For the API the function returns the new index.html as a string. You can of course still use the outPath or write options to mimic the CLI functionality.

const buildPage = require('tram-build-page')
const newIndexPage = buildPage({
  appPath: './main.js',
  route: '/hello',
  indexPath: './public/index.html'
})

About

🚡CLI and JS tool for building a single page off of a tram-one web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published