Book Image

Meteor Cookbook

By : Isaac Strack
Book Image

Meteor Cookbook

By: Isaac Strack

Overview of this book

Table of Contents (19 chapters)
Meteor Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using npm packages directly


We have seen from the Using npm modules recipe in Chapter 2, Customizing with Packages, how to wrap npm packages inside your own personal package, using the Npm.depends() directive. That's all well and good, but what if we want to just use npm directly, without creating a custom package? Arunoda Susiripala — one of the most prolific (and brilliant) Meteor community developers, has written a package that helps us do just that. In this recipe, you will learn how to use the meteorhacks:npm package to implement a npm module directly in your code. Specifically, we will use the Highlight.js module on the server to properly format JavaScript code, as you might see in markdown or in an online code editor.

Getting ready

We will be using a default project installation, with the client, server, and both folders, to keep the code clean and readable. We will also use the private folder for some static content, so let's add that while we're at it. In a terminal window, navigate...