diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8165e3f --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +ISC License (ISC) + +Copyright (c) Jérôme Gamez, https://github.com/jeromegamez + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8461fa --- /dev/null +++ b/README.md @@ -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: "me@example.com" + 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 \ No newline at end of file diff --git a/cookiecutter.json b/cookiecutter.json new file mode 100644 index 0000000..4bc8ab7 --- /dev/null +++ b/cookiecutter.json @@ -0,0 +1,8 @@ +{ + "full_name": "Beste Person", + "email": "hey@beste.best", + "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 }}" +} diff --git a/hooks/post_gen_project.sh b/hooks/post_gen_project.sh new file mode 100755 index 0000000..c735960 --- /dev/null +++ b/hooks/post_gen_project.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +composer update + +git init + +git add -A + +git commit -m "Get started with Kirby" diff --git a/{{cookiecutter.project_slug}}/.editorconfig b/{{cookiecutter.project_slug}}/.editorconfig new file mode 100644 index 0000000..9ac4524 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.editorconfig @@ -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 diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore new file mode 100644 index 0000000..f490a80 --- /dev/null +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -0,0 +1,3 @@ +/config/.license +/public/media +/vendor/ diff --git a/{{cookiecutter.project_slug}}/composer.json b/{{cookiecutter.project_slug}}/composer.json new file mode 100644 index 0000000..034228d --- /dev/null +++ b/{{cookiecutter.project_slug}}/composer.json @@ -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" + ] + } +} diff --git a/{{cookiecutter.project_slug}}/content/error/error.txt b/{{cookiecutter.project_slug}}/content/error/error.txt new file mode 100644 index 0000000..8825bf7 --- /dev/null +++ b/{{cookiecutter.project_slug}}/content/error/error.txt @@ -0,0 +1 @@ +Title: Error diff --git a/{{cookiecutter.project_slug}}/content/home/default.txt b/{{cookiecutter.project_slug}}/content/home/default.txt new file mode 100644 index 0000000..d9d22c8 --- /dev/null +++ b/{{cookiecutter.project_slug}}/content/home/default.txt @@ -0,0 +1,5 @@ +Title: Home + +---- + +Text: Welcome to **{{ cookiecutter.kirby_title }}** diff --git a/{{cookiecutter.project_slug}}/content/site.txt b/{{cookiecutter.project_slug}}/content/site.txt new file mode 100644 index 0000000..308da3a --- /dev/null +++ b/{{cookiecutter.project_slug}}/content/site.txt @@ -0,0 +1 @@ +Title: {{ cookiecutter.kirby_title }} diff --git a/{{cookiecutter.project_slug}}/public/index.php b/{{cookiecutter.project_slug}}/public/index.php new file mode 100644 index 0000000..e0d5c08 --- /dev/null +++ b/{{cookiecutter.project_slug}}/public/index.php @@ -0,0 +1,24 @@ + [ + '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(); diff --git a/{{cookiecutter.project_slug}}/site/blueprints/pages/default.yml b/{{cookiecutter.project_slug}}/site/blueprints/pages/default.yml new file mode 100644 index 0000000..e072bd1 --- /dev/null +++ b/{{cookiecutter.project_slug}}/site/blueprints/pages/default.yml @@ -0,0 +1,7 @@ +title: Default Page +preset: page +fields: + text: + label: Text + type: textarea + size: large diff --git a/{{cookiecutter.project_slug}}/site/blueprints/site.yml b/{{cookiecutter.project_slug}}/site/blueprints/site.yml new file mode 100644 index 0000000..3dd50f1 --- /dev/null +++ b/{{cookiecutter.project_slug}}/site/blueprints/site.yml @@ -0,0 +1,3 @@ +title: Site +preset: pages +unlisted: true diff --git a/{{cookiecutter.project_slug}}/site/config/config.php b/{{cookiecutter.project_slug}}/site/config/config.php new file mode 100644 index 0000000..6a06e03 --- /dev/null +++ b/{{cookiecutter.project_slug}}/site/config/config.php @@ -0,0 +1,5 @@ + false, +]; diff --git a/{{cookiecutter.project_slug}}/site/templates/default.php b/{{cookiecutter.project_slug}}/site/templates/default.php new file mode 100644 index 0000000..0d5fb7f --- /dev/null +++ b/{{cookiecutter.project_slug}}/site/templates/default.php @@ -0,0 +1,3 @@ +

title()->html() ?>

+ +text()->kirbytext() ?> diff --git a/{{cookiecutter.project_slug}}/storage/.gitignore b/{{cookiecutter.project_slug}}/storage/.gitignore new file mode 100644 index 0000000..9b39641 --- /dev/null +++ b/{{cookiecutter.project_slug}}/storage/.gitignore @@ -0,0 +1,3 @@ +/* +!/media +!/.gitignore diff --git a/{{cookiecutter.project_slug}}/storage/media/.gitignore b/{{cookiecutter.project_slug}}/storage/media/.gitignore new file mode 100644 index 0000000..a68d087 --- /dev/null +++ b/{{cookiecutter.project_slug}}/storage/media/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore