Download the PHP package amteich/kirby-patterns without Composer

On this page you can find all versions of the php package amteich/kirby-patterns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-patterns

Patterns Plugin for Kirby 3 with Twig Plugin (> v4.0.0)

This is a forked and updated version of the Kirby 3 Patterns Plugin of Steffen Wargalla.

What does it do?

With Kirby Patterns you can build your site with clean reusable modules, while the plugin creates a living styleguide for you automatically.

Video Demo

https://vimeo.com/153132557

Screenshots

https://gist.github.com/bastianallgeier/27f604fc838a266be482#gistcomment-1677662

Installation

  1. Install Kirby. I'd recommend Kirby's Plainkit
  2. Download Kirby Patterns from Github
  3. Copy the patterns folder into /site/plugins (Create the plugins folder if it does not exist yet)
  4. Create a new /site/patterns folder and start building your patterns in there.

Patterns readme.md

As on of your first steps after the installation, you should put a readme.md in /site/patterns This will automatically be used by the Patterns interface to provide a nice little introduction page for your library.

Options

The following options can be set in your /site/config/config.php

patterns.lock

You can lock the Patterns interface, so it will only be accessible by users, who logged into the Kirby Panel first.

patterns.title

Sets the title, which appears in the browser and in the topbar of the Patterns interface. By default this is set to Patterns

patterns.path

You can use this option to change the location of the Patterns interface. By default it will be located at http://yourdomain.com/patterns Only set the path with this option though. The URL must be omitted.

patterns.directory

Set the full path to your patterns directory with this option. By default the patterns directory must be located in site/patterns

patterns.preview.mode

The default mode to display a pattern is the iframe preview, if a html template file exists. This gives the best impression how the pattern will look on your site. But you can change this to twig or html instead to switch to the particular tab by default.

Valid values:

patterns.preview.background

You can use this option to set the default background color for the pattern preview screen. Any valid CSS value can be used. By default no specific color value is being set. A pattern can overwrite this with the background option (see further down)

patterns.preview.css

Use this option to set where the final CSS for your patterns is located. All the specified CSS files will be loaded in the preview screen in order to style your patterns appropriately. By default the Patterns interface is looking for a /assets/css/index.css file.

You can load multiple CSS files by passing an array of files:

patterns.preview.js

Use this option to set where the final JS for your patterns is located. All the specified JS files will be loaded in the preview screen (in the footer) in order to apply behaviour to your patterns. By default the Patterns interface is looking for a /assets/js/index.js file.

You can load multiple JS files by passing an array of files:

Creating a pattern

You can add a subfolder to /site/patterns for each of your patterns and even nest them however you like.

A pattern folder can contain any number of files, which belong to the pattern.

You should provide a markdown file in order to add documentation for your pattern. The Pattern interface will automatically parse the markdown and convert it into a nice doc page. You can even use Kirbytext in your markdown files.

Pattern template

Patterns don't necessarily need to have a template file, but if you want to use them in your templates or snippets, you should create a file called {patternname}.twig in the pattern folder.

In your pattern template you can use all the methods and functions from Kirby's APIs. You have full access to the $site, $pages and $page variable and everything else mentioned in the cheat sheet.

Pattern configuration

You can add an optional config.php file to your pattern to further set it up.

A pattern config file must return an associative PHP array:

title

The default title for a pattern is the name of the pattern folder. You can change this in the config though to make it more human readable.

defaults

With the defaults variable you can pass data to the pattern, which will be used if it is not being overwritten by the pattern method, when using the pattern.

background

With the background variable you can determine the background color for the pattern preview. This can be helpful if a pattern does not define a background color in CSS itself, but is always placed on a dark background for example, when being used within another pattern. Any valid CSS color value can be used.

hide

It might be useful sometimes to create a pattern in your patterns folder, which should not be visible in the Patterns interface. You can use the hide variable therefor to hide particular patterns.

preview

The preview callback option can be used to execute code before the pattern is being rendered in the Patterns interface. This can be helpful to generate dynamic defaults for the pattern, which will only be used for the preview and not when the pattern is used on your site.

Optionally the callback can return an associative array, which will be used to set/overwrite the defaults for the pattern.

Using a pattern

To use a pattern in your Kirby templates or snippets you can use the new pattern() method, which will be available as soon as the plugin is being installed.

Passing options to the pattern

You can pass additional variables and options to the pattern and overwrite its defaults that way.

Nesting patterns

You can use the pattern() method directly within a pattern template file to nest patterns.

Build process example

Since all the CSS and JS files should be stored directly with a pattern, you probably need some kind of build process in order to pre/post-process, concatenate and compress them. The plugin does not force you into any specific workflow. Here's a simple example gulp file, which I am using as a boilerplate for my projects though:

In order to use this, you must install the dependencies via npm first:

Afterwards you can run gulp in order to build the assets or gulp watch to work on your patterns and convert the assets on the fly.

I am by no means the best frontend dev out there, so I'm sure you will find a smarter way to setup your build process with grunt, gulp or npm anyway.

Customizing the design of the Patterns interface

The dark default theme might not be for everyone, but it's very easy to load your own stylesheet and even js to customize the interface. The app is looking for an /assets/patterns/index.css and a /assets/patterns/index.js file. If not provided it will load the default theme. So by adding those files you can overwrite any styles you want.

Requirements

License

http://www.opensource.org/licenses/mit-license.php

Authors

Kirby 2 version

Bastian Allgeier
[email protected]
http://getkirby.com
http://twitter.com/getkirby

Kirby 3 compatibility

Steffen Wargalla
[email protected]

Twig compatibility

Christian Zehetner https://am-teich.com


All versions of kirby-patterns with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
getkirby/composer-installer Version ^1.1
vanilla/htmlawed Version ^2.2
bnomei/kirby3-fingerprint Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amteich/kirby-patterns contains the following files

Loading the files please wait ....