Skip to content

Public API

Brian Muenzenmeyer edited this page Oct 11, 2017 · 11 revisions

Pattern Lab Node Public API

Pattern Lab Node 2.X API

Instance Methods

// instantiation. assumed first step for below
const config = require('./patternlab-config.json');
const patternlab = require('patternlab-node')(config);
// print help
patternlab.help();
// build
patternlab.build(callback, deletePatternDir);
// build patterns only
patternlab.patternsonly(callback, deletePatternDir);
// log version to console
patternlab.version(); // v3.0.0
// return package.json version as string
patternlab.v(); // v3.0.0
// log available starterkits
// https://api.github.com/search/repositories?q=starterkit+in:name+user:pattern-lab&sort=stars&order=desc
patternlab.liststarterkits(); // [{"name": "starterkit-mustache-demo", "url": "https://github.com/pattern-lab/starterkit-mustache-demo" }, ..] 
// load starterkit already available via `node_modules/`
patternlab.loadstarterkit(starterkitname, clean); // void
// install plugin already available via `node_modules/`
patternlab.installplugin(pluginname); // void
// returns all file extensions supported by installed PatternEngines
patternlab.getSupportedTemplateExtensions(); // ['.handlebars', '.hbs']

Pattern Lab Node 3.X API

Instance Methods

enablePlugin disablePlugin export getSupportedTemplateExtensions renamed to getsupportedtemplateextensions