1.2.0 • Published 3 years ago

scaffe v1.2.0

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

Tests workflow npm.io npm.io

Simple scaffolding utility, inspired by Sao.js

Installation

$ npm install scaffe # yarn add scaffe

Programmatic Usage

const scaffe = require("scaffe")

async function main(){
  ...

  // create a generator instance
  const s = scaffe.generate(templateDir, outDir, { overwrite: true, variables: { name: "app" } })

  // add a file from outside the templateDir
  // the source path should be relative to templateDir
  s.add("../common/logo.png", "assets/logo.png")

  // add multiple files using glob pattern to the target project directory
  // the source path should be relative to templateDir
  s.add("../common/styles/*.scss", "static/css/")

  // ignore certain files
  s.ignore("docs/**/*.scss")

  // ignore certain folder
  s.ignore("build/**/*")

  try {
    await s;
  } catch(err) {
    console.log(err)
  }
}

Template directory can have two types of files

  • starts with _: this file will be evaluated as an ejs file
  • doesn't starts with _: this type of files will be copied as it is to the output directory.

So we can use variables in our template files in ejs format.

A use case,

// _package.json

{
  "name": "<%= appName %>"
}

variables in 3rd argument (i.e. config) will contain all variable values that need to be passed on to be processed by ejs.

MORE ON USING SCAFFE

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago