metalsmith-mock
v2.0.0
Published
Generate mock data for Metalsmith HTML templates
Downloads
25
Readme
metalsmith-mock
Generate mock data for Metalsmith HTML templates
Quickstart
- Install metalsmith-mock with npm
npm install metalsmith-mock --save-dev
- Add
data-mock
attributes to html
<span data-mock="memberId:1"></span>
<span data-mock="customerId:1"></span>
- Add
metalsmith-mock
plugin to metalsmith
const metalsmith = require('metlasmith');
const metalsmithMock = require('metalsmith-mock');
metalsmith(__dirname)
.use(metalsmithMock())
.build();
Output
<span data-mock="memberId:1">981479716</span>
<span data-mock="customerId:1">6564503975</span>
API
<div data-mock="mock:identityKey"></div>
metalsmith-mock not only allows for the dynamic creation of mock data but also the reuse of the mock data identities throughout HTML templates.
When metalsmith-mock first encounters a data-mock
attribute, it checks to see if that mock identity key has been previously defined and if so, uses that mock identify throughout all metalsmith templates.
If the mock identify key hasn't been previously defined, a new identify is created and cached in metal.metadata().mocks[identityKey]
object.
Mock Options
- fullName
- fullNameReverse
- sexShort
- dob
- memberId
- customerId
- groupNumber
- addressLine1
- addressLine2
- sentence
- sentences
- paragraph
- paragraphs
- diagnosisType
- procedureCode
Authors
Robert McGuinness
Disclaimer
Open source software components distributed or made available in the Availity Materials are licensed to Company under the terms of the applicable open source license agreements, which may be found in text files included in the Availity Materials.
Copyright and license
Code and documentation copyright 2016 Availity, LLC. Code released under the MIT license.