Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Apr 25, 2021
0 parents commit 96b0961
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ISC License (ISC)

Copyright (c) Jérôme Gamez, https://github.com/jeromegamez <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Kirby Plainkit Cookiecutter

A [Cookiecutter] template to start a fresh [Kirby] site with a [public folder setup].

## Features

* A fresh, git(Hub)-ready plainkit Kirby site
* The site title is already set up
* Run it locally out of the box with [Valet] or with `composer start`
* Media is stored folder is located in `storage/media` folder and symlinked to `public/media`

## Using this cookiecutter

[Install Cookiecutter][Cookiecutter Installation Docs]:

```shell
$ pip install -U cookiecutter
# Or, on a mac with Homebrew
$ brew install cookiecutter
```

Generate a new Kirby site:

```shell
$ cookiecutter gh:beste/kirby-plainkit
```

## User config

If you use this (or other) Cookiecutters a lot, you can override the defaults by having
a `.cookiecutterrc` file in your home directory:

```yml
default_context:
full_name: "My full name"
email: "[email protected]"
github_username: "mygithubusername"
abbreviations:
kirby: https://github.com/beste/kirby-plainkit
```
You can find more information at https://cookiecutter.readthedocs.io/en/latest/advanced/user_config.html
[Cookiecutter]: https://github.com/cookiecutter/cookiecutter/
[Cookiecutter Installation Docs]: https://cookiecutter.readthedocs.io/en/latest/installation.html
[Kirby]: https://getkirby.com
[public folder setup]: https://getkirby.com/docs/guide/configuration#custom-folder-setup__public-folder-setup
[Laravel Valet]: https://getkirby.com/docs/cookbook/setup/development-environment#laravel-valet
8 changes: 8 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"full_name": "Beste Person",
"email": "[email protected]",
"github_username": "beste",
"kirby_title": "My new website",
"project_slug": "{{ cookiecutter.kirby_title.lower().replace(' ', '-').replace('_', '-') }}",
"composer_package_name": "{{ cookiecutter.github_username.lower() }}/{{ cookiecutter.project_slug }}"
}
9 changes: 9 additions & 0 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

composer update

git init

git add -A

git commit -m "Get started with Kirby"
12 changes: 12 additions & 0 deletions {{cookiecutter.project_slug}}/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/config/.license
/public/media
/vendor/
26 changes: 26 additions & 0 deletions {{cookiecutter.project_slug}}/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "{{ cookiecutter.composer_package_name }}",
"description": "{{ cookiecutter.kirby_title }}",
"type": "project",
"license": "ISC",
"authors": [
{
"name": "{{ cookiecutter.full_name }}",
"email": "{{ cookiecutter.email }}"
}
],
"require": {
"getkirby/cms": "^3.5.3.1"
},
"config": {
"optimize-autoloader": true
},
"extra": {
"kirby-cms-path": false
},
"scripts": {
"start": [
"@php -S localhost:8000 -t public"
]
}
}
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/content/error/error.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Title: Error
5 changes: 5 additions & 0 deletions {{cookiecutter.project_slug}}/content/home/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Title: Home

----

Text: Welcome to **{{ cookiecutter.kirby_title }}**
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/content/site.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Title: {{ cookiecutter.kirby_title }}
24 changes: 24 additions & 0 deletions {{cookiecutter.project_slug}}/public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

require __DIR__.'/../vendor/autoload.php';

$kirby = (new \Kirby\Cms\App([
'roots' => [
'index' => __DIR__,
'base' => $base = dirname(__DIR__),
'content' => $base . '/content',
'site' => $base . '/site',
'storage' => $storage = $base . '/storage',
'accounts' => $storage . '/accounts',
'cache' => $storage . '/cache',
'logs' => $storage . '/logs',
'media' => $storage . '/media',
'sessions' => $storage . '/sessions',
]
]));

if (!file_exists(__DIR__ . '/media')) {
symlink($kirby->roots()->media(), __DIR__ . '/media');
}

echo $kirby->render();
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Default Page
preset: page
fields:
text:
label: Text
type: textarea
size: large
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/site/blueprints/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
title: Site
preset: pages
unlisted: true
5 changes: 5 additions & 0 deletions {{cookiecutter.project_slug}}/site/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'debug' => false,
];
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/site/templates/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1><?= $page->title()->html() ?></h1>

<?= $page->text()->kirbytext() ?>
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/storage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
!/media
!/.gitignore
2 changes: 2 additions & 0 deletions {{cookiecutter.project_slug}}/storage/media/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
!/.gitignore

0 comments on commit 96b0961

Please sign in to comment.