Skip to content
Ruben Rodriguez edited this page Jan 4, 2018 · 2 revisions

This repository is used as the base that is cloned with any instance of rm-wh create or rm-wh update. The entry point of the application is a series of commands available via grunt. These commands are responsible for downloading data from firebase & using it to build the static site which is saved to .build directory.

Commands

grunt with no arguments:

grunt

This will go through the build process, start a local development server at localhost:2002, and watch for changes to pages/ & templates/ that will trigger a rebuild of the site. This is also how CMS changes are made, by visiting localhost:2002/cms. Visiting the CMS through this local server will include a section to Add/Edit Content Types.

Optionally:

  • Pass --skipBuild to only build the CMS page as part of the initial build. This is useful for making content type edits in the CMS, without having to wait for the build to occur first. Subsequent builds that are triggered by changing files in the pages/ & templates/ directory will build all pages & templates.

grunt --skipBuild


download-data to get the site data:

grunt download-data

This is a data object that gets used interally by the build process.

Optionally:

  • Pass --toFile= to define where the data gets saved. Defaults to the build processs cache location ./.build/data.json.

grunt download-data --toFile=secondary-build/build-data.json


build-template to build an individual template:

grunt build-template --inFile=templates/departments/individual.html

Optionally:

  • Pass in --data= to load a CMS data object from a file. Data that conforms to that shape that is required by the build processes can be obtained by running grunt download-data.
  • Pass --emitter to have the process log out when documents are written.

grunt build-template --inFile=templates/departments/individual.html --data=.build/data.json --emitter


build-templates to build all templates:

grunt build-templates

Optionally:

  • Pass in --templates=
  • Pass in --data= to load a CMS data object from a file. Data that conforms to that shape that is required by the build processes can be obtained by running grunt download-data.
  • Pass in --concurrency= to define the number of threads to use in the build process. One template file will be assigned to each thread. The default is half the number of CPUs available. Use the value max to use all CPUs available.
  • Pass --itemKey to build only the template for that key in the database.
  • Pass --emitter to have the process log out when documents are written.

grunt build-templates --data=.build/data.json --concurrency=max --emitter


build-page to build an individual page:

grunt build-page --inFile=index.html

inFile is the page to build. Expects the file to live in the pages directory, so it does not require having the pages/ directory prefix.

Optionally:

  • Pass --outFile= to define where the file gets written. Defaults to the same relative path as the input file but relative to the build directory, .build/.
  • Pass in --data= to load a CMS data object from a file. Data that conforms to that shape that is required by the build processes can be obtained by running grunt download-data.
  • Pass --emitter to have the process log out when documents are written.

grunt build-page --inFile=index.html --outFile=secondary-build/homepage.html --data=.build/data.json --emitter


build-pages to build all pages/

grunt build-pages

Optionally:

  • Pass in --data= to load a CMS data object from a file. Data that conforms to that shape that is required by the build processes can be obtained by running grunt download-data.
  • Pass in --concurrency= to define the number of threads to use in the build process. One template file will be assigned to each thread. The default is half the number of CPUs available. Use the value max to use all CPUs available. *
  • Pass --emitter to have the process log out when documents are written.
  • concurrency is still on the todo list. For now a single thread is used to build all pages.

build-order adds a .build-order directory for build order configuration if it does not exist.

grunt build-order

The .build-order directory includes a file named default, and a file named ordered. Files should be copied from default into ordered, in the desired build order.

If no .build-order folder has been defined, the server will build the site using a single build command.

Clone this wiki locally