Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/envygeeks/jekyll-faker
Faker wrapper for Jekyll, a library that generates fake data
https://github.com/envygeeks/jekyll-faker
content jekyll prototyping ruby user-interface
Last synced: about 2 months ago
JSON representation
Faker wrapper for Jekyll, a library that generates fake data
- Host: GitHub
- URL: https://github.com/envygeeks/jekyll-faker
- Owner: envygeeks
- License: apache-2.0
- Created: 2017-11-29T23:35:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-10T04:52:23.000Z (almost 7 years ago)
- Last Synced: 2024-10-15T19:22:24.023Z (2 months ago)
- Topics: content, jekyll, prototyping, ruby, user-interface
- Language: Ruby
- Homepage: https://rubygems.org/gems/jekyll-faker
- Size: 62.5 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/codeowners
Awesome Lists containing this project
README
[![Code Climate](https://img.shields.io/codeclimate/maintainability/anomaly/jekyll-faker.svg?style=for-the-badge)](https://codeclimate.com/github/anomaly/jekyll-faker/maintainability)
[![Code Climate](https://img.shields.io/codeclimate/c/anomaly/jekyll-faker.svg?style=for-the-badge)](https://codeclimate.com/github/anomaly/jekyll-faker/coverage)
[![Travis CI](https://img.shields.io/travis/anomaly/jekyll-faker/master.svg?style=for-the-badge)](https://travis-ci.org/anomaly/jekyll-faker)
![Gem Version](https://img.shields.io/gem/v/jekyll-faker.svg?style=for-the-badge)
![Gem DL](https://img.shields.io/gem/dt/jekyll-faker.svg?style=for-the-badge)# Jekyll Faker
Jekyll Faker is a Jekyll/Liquid wrapper around the Faker gem, it allows you to do anything that Faker allows you to do, as long as it's an acceptable format. It is disaware of it's surroundings, and is extensible by automatic upgrade, meaning... if faker adds new methods, or even new classes, you can continue to use it without needing to upgrade Jekyll Faker.
## Installing
```ruby
gem "jekyll-faker"
gem "jekyll-faker", {
git: "https://github.com/anomaly/jekyll-faker.git"
}
```## Usage
Given faker has a class called `Lorem`, and that class `Lorem` accepts messages to the method `sentences`, you can then do the following to extract the data from `Faker`:
```liquid
{% faker lorem sentences=8 %}
{{ faker.val }}
{% endfaker %}
```w/ the result
```html
Sentence 1
Sentence 2
Sentence 3
Sentence 4
Sentence 5
Sentence 6
Sentence 7
Sentence 8
```### Multiple Arguments
If a class and method you wish to use takes multiple arguments, you can replicate the name of the method multiple times to create an array that will be expanded, and messaged to the method. For example:
```liquid
{% faker number between=1 between=10 %}
{{ faker.val }}
{% endfaker %}
```### CamelCase classes
If a Faker is a CamelCased class, for example "DrWho" (even though technically it's supposed to be DoctorWho, it's Doctor, not Dr, who even does that?) You can do the following:
```liquid
{% faker dr-who catch_phrase %}
{{ faker.val }}
{% endfaker %}
```or
```liquid
{% faker id-number valid %}
{{ faker.val }}
{% endfaker %}
```**We will attempt to determine the class name automatically, first, efficiently by assuming the dash is a literal for uppercase, and then by doing a simple regexp search, this should often result in the class being found.***