Npm package.json scripts can be used to run various commands. Here, we will learn how to run the TypeScript compiler to generate JavaScript output from TypeScript source files. Before we start, make sure you have Node.js and npm installed.


In a new folder, create a file named script.ts. Then, add some sample code so we can test whether the JavaScript output is being generated properly.

const msg: string = "Hello World!";

TypeScript Compiler

In the same folder, create a new file named tsconfig.json. Here is the TypeScript official documentation for configuring tsconfig.json.

Your tsconfig.json file should look like this:


EJS is a templating language that uses JavaScript to generate HTML. This post will illustrate how to use Node.js with TypeScript to render an EJS file into HTML markup. Please make sure you have Node.js and npm installed first. If you are unfamiliar with Typescript please read my post describing how to compile TypeScript with npm.


Begin by creating a new EJS file named index.ejs. This file will be the template used to generate index.html. If the model is passed into the template it will render the content as a paragraph.

<!-- Sample Page -->
<h1>Sample Page</h1>
<% if (model)…

There are a variety of ways to send an email with Node.js. One way is to utilize the email service offered by SendGrid. The email API has a free plan, which does have a usage limit, specified on their website, but it should be enough for example purposes. To use the SendGrid Mail Service npm package, an API key is required which can be obtained by creating a new SendGrid account.

SendGrid API Key

If you are having trouble creating an API key, please view the API Keys documentation provided by SendGrid. With the API key obtained, we can begin writing code that…

This post is an updated version of a previous post containing instructions on how to compile sass with the node-sass npm package, which is now deprecated.

The SASS team now recommends using Dart Sass in favor of LibSass for new development projects. This means that the sass npm package should be used instead of the node-sass npm package, which is built on top of LibSass, to compile sass with Node.js. The sass npm package is a pure JavaScript implementation of Dart Sass. The Dart Sass JavaScript API strives to be compatible with the existing node-sass API, so that it can…

UPDATE: The steps in this post show how to compile sass using the node-sass npm package, which is built on top of LibSass. LibSass is now deprecated in favor of Dart Sass, the new primary implementation of SASS. You will want to reference my other post that shows how to use the Dart Sass JavaScript implementation with npm for the most current way of using npm to compile SASS.

There are many different ways to compile SCSS, one of the two syntaxes supported by SASS. In this post we will explore the utilization of the node-sass npm package. We’ll also…


Freelance Web Developer | |

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store