Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

Latest commit

 

History

History
66 lines (60 loc) · 1.24 KB

manually-creating-an-app.md

File metadata and controls

66 lines (60 loc) · 1.24 KB

Manually creating an app

First, install Reboost

# Using npm
npm i -D reboost

# Using yarn
yarn add -D reboost

Assume that the file structure is like this

public/
  index.html
src/
  add.js
  subtract.js
  index.js
package.json

Scripts content

// src/add.js
export const add = (a, b) => a + b;

// src/subtract.js
export const subtract = (a, b) => a - b;

// src/index.js
import { add } from './add';
import { subtract } from './subtract';

console.log('1 + 3 =', add(1, 3));
console.log('10 - 5 =', subtract(10, 5));

and the HTML content (public/index.html)

<!doctype html>
<html>
  <body>
    <!-- Both tags are required -->
    <script type="module" src="./dist/index.js"></script>
    <script nomodule src="./dist/index.js"></script>
  </body>
</html>

then create a file named reboost.js

const { start } = require('reboost');

start({
  entries: [
    // Format - [inputPath, outputPath]
    ['./src/index.js', './public/dist/index.js']
  ],
  contentServer: {
    root: './public',
    open: true // Opens the browser
  }
})

after that run the script using node, open your terminal in that directory and use the command

node reboost

You can see your code is working without any problem.