Foreman CLI

Foreman helps you build awesome things for the internet.

In a nutshell, Foreman cli provides a set of small tools that help you build awesome things for the internet.

Key Features

  • Set up a new project structure in seconds.
  • Scaffold out a new HTML, Jekyll or Angular site in seconds.
  • Develop with SASS, Browserify (CommonJS), BrowserSync, Jekyll.
  • Build process to optimise assets for deployment.

Available commands

  • Project commands
    • Foreman folders
      Scaffolds a set of project folders to help you organise your project better.
  • Dev commands
    • Foreman create
      Creates a new Konstruct starter project through an interactive wizard.
    • Foreman refresh
      Refreshes the project by installing dependencies again. Useful if you inherit a repo from another developer in your team.
    • Foreman watch
      Watches your project for changes, compiles scss files to css, commonJS to js & refreshes your browser.
    • Foreman build
      Prepares your css & js files by minifying them.

Install Foreman

npm install -g konstruct-foreman

Uses existing tools

This is by no means a new build tool to replace the likes of webpack, gulp or any of the others. The CLI use common node packages like:

  • browserify
  • watchify
  • node-sass
  • cssnano
  • autoprefixer
  • browser-sync
  • uglifyjs

Why build this at all?

Foreman was given life because of 3 main reasons:

Build tools are a nightmare

I started off with Gulp like everybody else, and life was good. Getting a basic build tool up and running is easy.

But then you need to modify things, add things, change how things work and life becomes gross quick. I especially ran afoul when I had to have 3 to 4 different gulp scripts for the different types of projects I work on regularly.

It quickly got out of control, and I found myself spending a lot of time fixing and updating my gulp scripts, which had obvious side effects - going back to an old project and nothing works as it should anymore.

When you want to build things, global is good

I work in an agency, and I work on a lot of projects. I absolutely hate having localised build scripts for 2 simple reasons:

  1. node_modules folder grows in excess of 100mb - which is just ludicrous, especially if your project is a simple static one pager.
  2. Making changes to my build flows invariably means having to update each project.

I needed a reason to learn more about nodejs

Why not just webpack?

I like the idea of webpack, and I am actually planning on using it in favour of the current browserify. However, I don’t agree with the idea that all your things should be js all of the time.

Sure, building React native apps, bring on the js. Building a static html site, or a Wordpress theme… not so much.