Skip to content

Instantly share code, notes, and snippets.

View artemdemo's full-sized avatar
🎯
Focusing

Artem Demo artemdemo

🎯
Focusing
View GitHub Profile
%reset-Button {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
/* inherit font & color from ancestor */
@artemdemo
artemdemo / How to create Node cli executable from npm.md
Created October 10, 2022 06:39 — forked from mritzco/How to create Node cli executable from npm.md
Create Node Package (cli) executable from npm scripts

Creating an executable NPM package and using it

This short guide explains how to create an NPM package that can be called as a script from another project. For clarity: The package to execute will be called: Module The place where you use it: Application

1. Build your module

Create a standard module ignore command line parsing

// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||