2.0.6 • Published 6 years ago

@smartfrog/motor v2.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
6 years ago

MOTOR

MOTOR is a lightweight engine aimed to rapidly build static pages by fetching entries from contentful CMS API and injecting their content into pug based layout sections.

Main features:

  • minimal setup required
  • highly flexible customization fitting any specific project structure
  • ultra simple and fast routing configuration
  • comprehensive internationalization support
  • Contentful Preview API support (previewing unpublished content as though it were published)
  • markdown support

Installation

using yarn

yarn add @smartfrog/motor

using npm

npm i -S @smartfrog/motor

Usage

please not that you need node v7.6 or v6 harmony mode to run this project

  1. create .env file from .env.sample or set needed them env variables from cli before starting motor
NODE_ENV        =   development
MOTOR_PORT      =   4000
SPACE_ID        =   contentful_SPACE_ID
ACCESS_TOKEN    =   contentful_ACCESS_TOKEN
  1. follow usage.sample.js and create your entry javascript file that it will reflect the project specs with the right paths.
const motor = require('motor')
const path = require('path')

const config = {
  path: {
    env: path.resolve(__dirname, '.env'),
    views: path.resolve(__dirname, 'views'),
    templates: path.resolve(__dirname, 'templates'),
    i18n: path.resolve(__dirname, 'i18n')
  },
  static: [
    {
      directory: 'static',
      path: path.resolve(__dirname, 'static')
    }
  ],
  supportedLangs: ['en', 'de']
}

motor(config)
  • run your entry file with node, so if the file called entry.js use
node entry

use nodemon for live-reload

internal project dev

1- install dependencies

$ yarn

or

$ npm i

2- add .env file and entry.js

3- run with live-reload

$ npm run dev

run without live-reload

$ npm start

Docs

generate docs with

$ npm run docs
  • project docs available under folder docs, you can serve it with http-server docs

Debug

you can view API traffic in your browser under debug/console

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

7 years ago

2.0.0

7 years ago