Skip to content

Instantly share code, notes, and snippets.

@smashingpat
Last active June 23, 2020 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smashingpat/60cf9edaa2862982d4c2301458cf7b9b to your computer and use it in GitHub Desktop.
Save smashingpat/60cf9edaa2862982d4c2301458cf7b9b to your computer and use it in GitHub Desktop.
Javascript/Typescript starter kit

Javascript/Typescript starter kit

Simple setup to get quick and fast going with the help of Parcel.

Setup

  1. Create a package.json and paste the following in:
{
  "name": "prototype",
  "scripts": {
    "start": "npm run clean && parcel serve src/index.html",
    "build": "npm run clean && parcel serve src/index.html",
    "clean": "rimraf dist"
  },
  "devDependencies": {
    "parcel": "^1.12.4",
    "rimraf": "^3.0.2",
    "typescript": "^3.9.5"
  },
  "dependencies": {
    "core-js": "^3.6.5"
  }
}
  1. Create de entry files like the src/index.html and src/main.ts
<!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>prototype</title>
  </head>
  <body>
      <script src="./main.ts"></script>
  </body>
</html>
import "core-js";

// code goes here
  1. Some commands to run the server
npm run start # start the dev server
npm run build # creates a production ready build
npm run clean # clean up the dist folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment