Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yosymfony/spress-plugin-dataloader
Load data located at _data/ folder of your site
https://github.com/yosymfony/spress-plugin-dataloader
json loader php spress yaml
Last synced: about 1 month ago
JSON representation
Load data located at _data/ folder of your site
- Host: GitHub
- URL: https://github.com/yosymfony/spress-plugin-dataloader
- Owner: yosymfony
- Created: 2014-01-08T16:44:47.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-13T22:25:20.000Z (almost 7 years ago)
- Last Synced: 2024-04-21T01:41:45.422Z (8 months ago)
- Topics: json, loader, php, spress, yaml
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Data loader plugin for Spress
![Spress 2 ready](https://img.shields.io/badge/Spress%202-ready-brightgreen.svg)
Loads data located at `./src/data/` folder of your site.
**This plugin requires Spress >= 2.0**. If you are using Spress 1.x, go to [1.0.0](https://github.com/yosymfony/spress-plugin-dataloader/tree/v1.0.0) version of the plugin.
### How to install?
Go to your site folder and input the following command:
```bash
$ spress add:plugin yosymfony/spress-plugin-dataloader
```### How to use?
Go to your Spress site an create `./src/data` folder. In this folder you can to create
[JSON](https://en.wikipedia.org/wiki/JSON), [YAML](https://en.wikipedia.org/wiki/YAML), [Markdown](https://en.wikipedia.org/wiki/Markdown) or Textfiles that will be available in `site.data.`.Example with an users array and a Json file:
```
./src/data/
|- blogUsers.json
```Example with an users array and a Yaml file (the extension `yaml` is valid too):
```
./src/data/
|- blogUsers.yml
```For markdown files the extension `md` or `markdown` are valid.
Text file extensions are `txt` or `text`.
Markdown and text files are available as string.Access to this data in Twig templates:
```twig
{% for theme in site.data.blogUsers %}
...
{% endfor %}
```