PHPackages                             bnomei/kirby3-plopfile - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. bnomei/kirby3-plopfile

AbandonedArchivedKirby-plugin[CLI &amp; Console](/categories/cli)

bnomei/kirby3-plopfile
======================

Plopfile to generate and append to various files for Kirby3 CMS using Plop.js

1.2.1(3y ago)7256MITJavaScriptPHP &gt;=8.0

Since Aug 3Pushed 1y ago2 watchersCompare

[ Source](https://github.com/bnomei/kirby3-plopfile)[ Packagist](https://packagist.org/packages/bnomei/kirby3-plopfile)[ RSS](/packages/bnomei-kirby3-plopfile/feed)WikiDiscussions main Synced yesterday

READMEChangelog (9)Dependencies (2)Versions (10)Used By (0)

Kirby Plopfile
==============

[](#kirby-plopfile)

[![Release](https://camo.githubusercontent.com/9040aff015c8006a27e6bf9032af4ae4a5fdf4a474a979dae0d8bd04ae4a8dcb/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d706c6f7066696c653f636f6c6f723d616538316666)](https://camo.githubusercontent.com/9040aff015c8006a27e6bf9032af4ae4a5fdf4a474a979dae0d8bd04ae4a8dcb/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d706c6f7066696c653f636f6c6f723d616538316666)[![Downloads](https://camo.githubusercontent.com/a470d8fe92c6bea39f14507d5cd31317fd7c1a987334cc187fdef30c5e571dfc/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d706c6f7066696c653f636f6c6f723d323732383232)](https://camo.githubusercontent.com/a470d8fe92c6bea39f14507d5cd31317fd7c1a987334cc187fdef30c5e571dfc/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d706c6f7066696c653f636f6c6f723d323732383232)[![Twitter](https://camo.githubusercontent.com/b90e4b58a887e8ad09ec267628b75199a48522a9e01e88b129e5d2d730dffe50/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f747769747465722f626e6f6d65693f636f6c6f723d363664396566)](https://twitter.com/bnomei)

Plopfile to generate and append to various files for Kirby3 CMS using Plop.js

What others (might have) said about this plugin
-----------------------------------------------

[](#what-others-might-have-said-about-this-plugin)

> 🤩
> *- K-nerd*

> Using generators is faster than grabbing and adjusting code from the official docs? Really? Awesome!
> *- Lasi Toiper*

> Finally a Kirby CLI on ploperoids with a gazzilion of appending generators.
> *- p10pa*

> I don't care how it works but it does! Unittests FTW.
> *- NewToThis*

Installation
------------

[](#installation)

### Plop.js (version 2)

[](#plopjs-version-2)

Install [Plop.js globally](https://plopjs.com). Plop.js is simplified just glue code between [inquirer](https://github.com/SBoudrias/Inquirer.js/) prompts and [handlebar](https://github.com/wycats/handlebars.js/) templates.

```
npm install -g plop@2
```

or

```
yarn global add plop@2
```

> NOTE: plop.js version 3 is not supported yet since all js files would need to be converted to ESM syntax.

### Kirby Plugin

[](#kirby-plugin)

- unzip [master.zip](https://github.com/bnomei/kirby3-plopfile/archive/master.zip) as folder `site/plugins/kirby3-plopfile` or
- `git submodule add https://github.com/bnomei/kirby3-plopfile.git site/plugins/kirby3-plopfile` or
- `composer require bnomei/kirby3-plopfile --dev`

### Plopfile for your project

[](#plopfile-for-your-project)

Copy `example.plopfile.js` from the plugin directory to your project root.

```
cp site/plugins/kirby3-plopfile/example.plopfile.js plopfile.js
```

### Node dependencies

[](#node-dependencies)

No node\_module dependencies are included. To use this plugin run `npm i` or `yarn` in the plugin folder.

Usage
-----

[](#usage)

### Use Plop to generate or append to files

[](#use-plop-to-generate-or-append-to-files)

Plop provides an interactive terminal UI. It let's you choose a generator and fill each prompt step by step.

```
plop
```

But you can also trigger a generator and [bypass some prompts](https://plopjs.com/documentation/#cli-usage). You can provide all prompts or choose to be prompted for some using `_` as an value. Generators that create files need a target folder. The plugin tries its best to guess your setup using `glob`. When bypassing the `folder`-prompt you can use `$` to default to your kirby root for that specific generator (like `site/templates` for `plop template $`).

```
# $ = kirbys default root for that generator
plop blueprint $ pages blogpost
plop template $ blogpost
plop content "Consistency made simple!" blog blogpost
plop content _ blog blogpost
plop snippet $ slideshow
```

Kirby Plugins `index.php` and Config files created using `plop config`/`plop plugin` can be appended with lots of [Kirbys extensions](https://getkirby.com/docs/reference/plugins/extensions). These generators have the prefix `conf-`/`ext-`. Some of them might require you to add a file to the plugin folder first before appending a reference to that file.

```
# adding inline code to plugins
plop plugin myname myplugin
plop ext-collection myplugin allBlogpages

# some files need to be referenced in the plugin index.php to work
plop blueprint myplugin pages contactform
plop ext-blueprint myplugin contactform
plop template myplugin contactform
plop ext-template myplugin contactform

# some extensions do not have a file on their own but are inlined to index.php
plop ext-route myplugin form/submit '' POST
```

### Usage of `config-` and `ext-` with existing files or when missing markers

[](#usage-of-config--and-ext--with-existing-files-or-when-missing-markers)

When creating files with `plop config` or `plop plugin` the generator will add markers to identify the location to append extensions. To make `config-` and `ext-` generators work with files not created by plop you have to manually add these strings to the respective files. Do not be afraid. It's very simple. The markers adhere to the following pattern:

```
[language specific comment] @PLOP_EXT_[extension name in uppercase, singular and low-dashes]

```

**example for PHP files**

```
// @PLOP_EXT_HOOK
// @PLOP_EXT_FILES_METHOD
```

**example site/config/config.php**

```
