jambo
v1.12.6
Published
A JAMStack implementation using Handlebars
Downloads
2,733
Keywords
Readme
Jambo
Jambo is a JAMStack implementation using Handlebars.
Installation
Install jambo from npm, and save it to your package.json as a dev-dependency.
npm install -D jambo
Usage
Jambo has 6 official commands: init, import, override, page, build, and upgrade.
Init
npx jambo init
Initiailizes the current directory as a Jambo repository.
The init command initializes a Jambo repo, and also imports the designated theme. Currently, only answers-hitchhiker-theme is supported.
Optional Arguments
--themeUrl theme_url
The git URL of the theme to import, if a theme should be imported on init.
--useSubmodules true/false
If importing a theme on init, whether to import it as a git submodule as opposed to regular files. Defaults to false.
Import
npx jambo import --themeUrl https://github.com/yext/answers-hitchhiker-theme.git
The import command imports the designated theme into the 'themes' folder.
--themeUrl theme_url
The git URL of the theme to import.
Optional Arguments
--useSubmodules true/false
Whether to import the theme as a git submodule, as opposed to regular files. Defaults to false.
Override
npx jambo override --theme answers-hitchhiker-theme
The override command lets you override a specified theme by copying its files into the overrides folder.
--theme theme_name
The name of the theme to override.
Optional Arguments
--path path_to_override
You can specify specific files(s) in the theme to override.
Page
npx jambo page --name new_page_name
The page command registers a new page, with the specified name, to be built by Jambo.
--name page_name
The name this page will be registered as.
- Optional Arguments
--template template_name
The template to generate the page with.
--layout layout_name
The layout to use around the page.
Build
npx jambo build
The build command builds all pages reigstered within Jambo, and places them inside the 'public' directory. The public directory will be cleared prior to each build, so any static assets in that directory will need to be re-generated.
The build command uses the 'defaultTheme' attribute in the jambo.json in Jambo's root directory, which must be added to jambo.json manually. Here is an example jambo.json.
{
"dirs": {
"themes":"themes",
"cards": "cards",
"config":"config",
"overrides":"overrides",
"output":"public",
"pages":"pages",
"layouts":"layouts"
},
"defaultTheme": "answers-hitchhiker-theme"
}
Helpers
The build command registers a few handlebars helpers for convenience:
json(context)
: Renders the context as JSONifeq(arg1, arg2, options)
: if arg1 == arg2 then options.fn, otherwise options.inverseread(fileName)
: Reads contents of the given fileNameconcat(prefix, id)
: Concatenates prefix + idbabel(options)
: Adds babel transforms to the given code with the options givenpartialPattern(cardPath, opt)
deepMerge(...args)
: Performs a deep merge of the given objects
Note: The babel helper does not polyfill all necessary functionality needed for IE11 for example. You should use global polyfills if you wish to use them in the code. For example, you might want to import core-js/stable.
Upgrade
npx jambo upgrade
The upgrade command updates your current defaultTheme to the latest version. It will also automatically execute the theme's upgrade.js script.
Optional Arguments
--disableScript true/false
You can disable automatic execution of the upgrade.js script in the theme. Defaults to false.
--isLegacy true/false
You can signal whether to pass an --isLegacy flag to the theme's upgrade.js. This can be useful when you need different/additional upgrade logic to upgrade from older versions of a theme. Defaults to false.