Pattern Lab Standard Edition for Twig

Overview

license Packagist Gitter

Pattern Lab Standard Edition for Twig

The Standard Edition for Twig gives developers and designers a clean and stable base from which to develop a Twig-based pattern library.

Packaged Components

The Standard Edition for Twig comes with the following components:

Installing

There are two methods for downloading and installing the Standard Edition for Twig:

Download a pre-built project

The fastest way to get started with the Standard Edition for Twig is to download the pre-built version from the releases page. The pre-built project comes with the Base StarterKit for Twig installed by default.

Please note: Pattern Lab uses Composer to manage project dependencies. To upgrade the Standard Edition for Twig or to install plug-ins you'll need to install Composer. We recommend that you install it globally.

Use Composer to create a project

Pattern Lab uses Composer to manage project dependencies.

1. Install Composer

Please follow the directions for installing Composer on the Composer website. We recommend you install it globally.

2. Install the Standard Edition for Twig

Use Composer's create-project command to install the Standard Edition for Twig into a location of your choosing. In Terminal type:

cd install/location/
composer create-project pattern-lab/edition-twig-standard your-project-name && cd $_

This will install the Standard Edition for Twig into a directory called your-project-name in install/location/. During the set-up process you will be asked to install an appropriate StarterKit. You will be automatically dropped into the project directory after the process is finished.

Updating Pattern Lab

To update Pattern Lab please refer to each component's GitHub repository. The components are listed at the top of the README.

Helpful Commands

These are some helpful commands you can use on the command line for working with Pattern Lab.

List all of the available commands

To list all available commands type:

php core/console --help

To list the options for a particular command type:

php core/console --help --[command]

Generate Pattern Lab

To generate the front-end for Pattern Lab type:

php core/console --generate

Watch for changes and re-generate Pattern Lab

To watch for changes and re-generate the front-end for Pattern Lab type:

php core/console --watch

Start a server to view Pattern Lab

You can use PHP's built-in web server to review your Pattern Lab project in a browser. In a seperate window type:

php core/console --server

Then open http://localhost:8080 in your browser.

Install a StarterKit

To install a near-empty StarterKit as a starting point for your project type:

php core/console --starterkit --init

To install a specific StarterKit from GitHub type:

php core/console --starterkit --install 
Comments
  • Installation within an existing project?

    Installation within an existing project?

    I have an existing project (Laravel-based, if you're curious), and we use Twig templates for our output.

    I was hoping to incorporate a styleguide system within my project, with the goal being that my SCSS/CSS and templates exist only in one place and are used for the live site and for the styleguide.

    My first step was to run composer require --dev pattern-lab/edition-twig-standard in my project (which actually required a bit of jiggling to keep dependencies in check). Then I thought I could run php vendor/pattern-lab/edition-twig-standard/core/console ... to get things going, but all I get is:

    it doesn't appear that pattern lab has been set-up yet...
    please install pattern lab's dependencies by typing: php core/bin/composer.phar install...
    

    The problem is that console is explictly expecting the vendor directory to be within the package, not the other way around:

    // set-up the project base directory
    $baseDir = __DIR__."/../";
    
    // auto-load classes
    if (file_exists($baseDir."vendor/autoload.php")) {
        require($baseDir."vendor/autoload.php");
    } else {
        print "it doesn't appear that pattern lab has been set-up yet...\n";
        print "please install pattern lab's dependencies by typing: php core/bin/composer.phar install...\n";
        exit;
    }
    

    I'm sure there is another way to check that dependencies are installed (or simply remove this check, since things will fail anyway which should be indication that the user missed something).

    But I'm also wondering whether other things (e.g. configuration) would work in a setup where Patternlab is a required package instead of an app in and of itself. Has anyone else done something like this?

    Thanks!

    opened by cviebrock 9
  • Could not open input file: core/console

    Could not open input file: core/console

    I've tried installing PatternLab both as a pre-built project and with Composer. Whenever I try to do anything with the command line I get this error:

    Could not open input file: core/console

    What do I need to do to fix this? I'm on Mac OS Sierra, PHP version 5.6.25. MAMP is installed.

    opened by darylknight 6
  • Is Faker integration easy/possible? Any tips on how?

    Is Faker integration easy/possible? Any tips on how?

    I see a older thread in the php edition that talked about adding Faker. Did that ever happen?

    Quick research says Faker can be autoloaded in Symfony projects… might make a good addition to the Twig version of PL. I don't have the experience or knowledge to know how.

    If it can be added into PL-twig easily or someone could give me the quick rundown of how to add it myself, I'd appreciate it.

    enhancement 
    opened by dave-cross 4
  • Configuring export directories

    Configuring export directories

    Hoping this is the appropriate place to ask this question. Apologies if it isn't.

    I'm looking to use the clean export function within PL to get a directory structure exported of my twig files that matches what's in the source directory. Ideally, this would include:

    - _data
    - _layouts
    - _macros
    - _meta
    - _patterns <-- with all variants etc.
    - _twig-components
    - images
    - js
    - etc. <-- any files and dirs that would normally export to public or export directories.
    

    In our shop we use a WordPress framework that makes use of twig files to build our templates with an MVC setup.

    I can copy and paste or setup a deploy of some sort to dump out, but the export feature seems to be the more "tool centric" way to go. Is it extensible at all? Could I customize that in some way? Thanks and I'll hang up and listen. :-)

    P.S. @dmolsen said to post here and maybe @aleksip or @EvanLovely could help me out. Thanks!

    opened by Webslung 3
  • How to use shorthand syntax outside of patternlab itself

    How to use shorthand syntax outside of patternlab itself

    We're building a WordPress starter theme which uses patternlab as a dependency in order for us to work using atomic design.

    The idea is to re-use the templates created in patternlab in our theme. However, using the normal twig way of doing things doesn't work as it can't interpret the shorthand syntax (http://patternlab.io/docs/pattern-including.html).

    Where is this set in the patternlab twig code? And how can we reuse it outside of patternlab?

    Thanks!

    PS The theme will be open source and we'd love to share it with the patternlab community!

    opened by adamf321 3
  • Concat vars in include

    Concat vars in include

    whe use {% include 'molecules-' ~ view.item ~ '-' ~ view.mode %} and generate patternlab the console show a warning {> molecules- }} is not a valid pattern... but the pattern is printed normally

    question 
    opened by ensk 2
  • Is there a way to get LiveReload working with this (Twig) version of PL?

    Is there a way to get LiveReload working with this (Twig) version of PL?

    I know hitting command + R isn't that hard of a task, but after getting used to LiveReload it's kind of a bummer not having it anymore. Has anyone had luck getting it to work?

    opened by lrobeson 1
  • Documentation on working with json data and twig?

    Documentation on working with json data and twig?

    Hi, not sure if Im asking this in the right place but any direction would be helpful.

    Aside from documentation on the Pattern Lab site are there any other sources that go into more detail on working with json data and twig files?

    Specifically what Im looking for is how to handle twig "if, for, set, etc..." statements as well as populating variables when set like foo[bar]. Ive been able to find examples of working with arrays so I was able to get that handled but Ive been looking high and low for examples of the above and just keep coming up short.

    Thanks!

    opened by justclint 0
  • Failed to extract the starterkit

    Failed to extract the starterkit

    Hi guys, Im new in gulp and emulsify, using windows 10 1703, php 7.1 and nvm for windows.

    In our project, we need to use emulsify, but I have problem to install it. Everything looks ok when emulsify is installing, but when pattern-lab is installing, there is problem with extracting starterkit:

    suggested starterkits that work with this edition:
    
      1: pattern-lab/starterkit-twig-base
      2: pattern-lab/starterkit-twig-demo
    
    
    downloading the starterkit. this may take a few minutes...
    finished downloading the starterkit...
    failed to extract the starterkit. easiest solution is to manually download it and copy <path>./dist</path to ./source/...
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] postinstall: `rm -rf pattern-lab && composer create-project -n pattern-lab/edition-twig-standard pattern-lab && rm -rf pattern-lab/source && ln -s ../components pattern-lab/source && git clone https://github.com/drupal-pattern-lab/bem-twig-extension.git && cp bem-twig-extension/bem.function.php components/_twig-components/functions && rm -rf bem-twig-extension/`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 
    

    I tried to download and copy dist from git, but when I type npm start, there is error for missing 'clean' task in gulpfile.js

    Thanks for suggestions

    opened by ghost 1
  • "php patternlab/core/console -generate" works local but not via jenkins

    Hi everyone,

    I have integrated pattern lab (php/twig version via download, not composer) into an existing project (in a folder called patternlab/ )and I've got everything running locally (both via vagrant box and fully local with mamp).

    I can run "php patternlab/core/console -generate" and all files in public/ are created as they should be. I even integrated that command via grunt shell and can run it automatically when needed.

    If I push the project to gitlab and my jenkins does his thing (npm install -> grunt prod etc.) the command is fires as well, I can see the moment jenkins executes the script and get the usual log:

    Running "shell:patternlab" (shell) task
    configuring pattern lab...
    your site has been generated...
    site generation took 0.18935704231262 seconds and used 8.25MB of memory...
    
    Done.
    

    my local generate command is a bit slower site generation took 1.3047921657562 seconds and used 8MB of memory...

    If I browse to the deployed site, I'm getting a lot of 404s as a lot of stuff is missing. public/css/ #missing public/js/ #missing public/fonts/ #missing public/images/ #missing

    from my public/patterns/ folder, most files are missing 00-atoms 00-atoms-04-images 00-atoms-04-images-00-logo #missing 00-atoms-06-buttons 00-atoms-06-buttons-01-buttons #missing 00-atoms-09-links 01-molecules 01-molecules-05-navigation 01-molecules-05-navigation-00-primary-nav #missing 01-molecules-05-navigation-01-language-nav #missing 02-organisms 02-organisms-00-global 02-organisms-00-global-00-header #missing 02-organisms-00-global-01-footer #missing 02-organisms-00-global-02-social #missing 02-organisms-04-forms 02-organisms-04-forms-00-contact #missing 03-templates 03-templates-00-layouts 03-templates-00-layouts-00-site #missing 03-templates-00-layouts-01-page-detail #missing 03-templates-00-layouts-01-page-legal #missing 03-templates-00-layouts-01-page-listing #missing 03-templates-00-layouts-01-page-scroll #missing 03-templates-01-index #missing 04-pages-01-index #missing

    this is my output from php -v from jenkins log

    PHP 5.6.33-0+deb8u1 (cli) (built: Jan  5 2018 15:46:26) 
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
        with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    

    and this is local (in vagrant)

    PHP 5.5.9-1ubuntu4.24 (cli) (built: Mar 16 2018 12:41:43) 
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
        with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    
    opened by KADlancer 0
  • Failing installations are very laconic

    Failing installations are very laconic

    Hello,

    I have been trying to install Patternlab PHP Twig to develop my website using Grav (Twig is the main reason I will use those two generating tools), but the installation is failing. Why is it failing?

    I would provide more details but this is all I have :

    [user@brix user]$ php core/console --starterkit --init
    configuring pattern lab...
    downloading the starterkit. this may take a few minutes...
    finished downloading the starterkit...
    failed to extract the starterkit. easiest solution is to manually download it and copy <path>./dist</path to ./source/...
    

    I did once the manual directive. This is quite annoying, because finding Twig Starterkit in that README.md asks reading the same files over and over again to find it and not mix up with the Styleguidekit.

    Is there any way to make it simpler to install it manually and if it's not succeeding, extensively telling why it does not?

    Thank you!

    opened by Palingenae 1
  • create project snippet installs code with a syntax error

    create project snippet installs code with a syntax error

    Just ran this from the readme:

    composer create-project pattern-lab/edition-development-twig pattern-library && cd $_

    And got this:

    > PatternLab\Installer::postUpdateCmd
    PHP Parse error:  syntax error, unexpected ')' in /Users/bdub/Projects/envirovantage-web-api-symfony/pattern-library/vendor/pattern-lab/core/src/PatternLab/InstallerUtil.php on line 353
    

    Sure enough, in that file, there's an extra paren:

    line 353:

    					$pathName = $file->getPathname());
    
    opened by BrianWalters 0
  • Watcher doesn't update browser display

    Watcher doesn't update browser display

    Background:

    • I got super excited reading Atomic Design and listening to the style guide podcast, so I installed the pre-built Twig standard version today on Windows 10. ✨
    • I'm using Wampserver64 to serve the project. I've been using wamp successfully for other PHP projects for a while. However, I'm not familiar with PHP CLI.
    • I first tried php core/console --serve in a Git Bash terminal and everything looked good in the terminal, but when I go to localhost:8080 there's a "connection refused" error.
    • With wamp I can access the site at http://localhost/pattern-lab/public.
    • My system PHP version is PHP 5.6.19 (cli) (built: Mar 2 2016 20:09:42).
    • php core/console --generate seems to work perfectly.

    Problem:

    When I type php core/console --watch in the terminal, it looks good:

    $ php core/console --watch
    configuring pattern lab...
    spawning the watch process...
    

    But then nothing else happens, either in the terminal or in the browser, when I update and save files. I have to run --generate again to see my changes in the browser.

    Possibly related to #https://github.com/pattern-lab/patternlab-php/issues/371 and/or #21?

    I realize there might be something deeper going on, since I ran into problems with --server too. DevOps gets me every time. 🙄

    Any tips? Thanks! 😄

    opened by KatieMFritz 4
Releases(v2.2.1)
This website for web pentesters and beginner bug bounty hunters,You can improve your hacking skills by practicing xss in this lab.

XSSLab [Not finished yet, it's under development] XSSLab is a vulnerable website coded By Mahdi Jaber "Mr MJT" {in digital world}.. By XSSLab you can

Mr MJT [Mahdi Jaber] 7 Aug 30, 2022
A tool for diff'ing this and OpenTHC lab metrics, creating their objects, and docs.

wcia-analytes-tool Consumes OpenTHC Lab Metrics and WCIA Analytes, and produces diff objects and docs for use in WA State interop. version 0.9.8 Getti

Confidence Analytics 1 Jan 15, 2022
A server software for Minecraft: Bedrock Edition in PHP

A highly customisable, open source server software for Minecraft: Bedrock Edition written in PHP Getting started Documentation Installation instructio

PMMP 3k Dec 31, 2022
An implementation of the Minecraft: Bedrock Edition protocol in PHP

BedrockProtocol An implementation of the Minecraft: Bedrock Edition protocol in PHP This library implements all of the packets in the Minecraft: Bedro

PMMP 94 Jan 6, 2023
A game-mode for Minecraft: Bedrock Edition

HardCoreFactions This is an unpaid commission that was only released for educational purposes, consider using it as a reference rather than having it

Doge 3 Sep 8, 2021
2022 edition of the inRage Theme fully based on Gutenberg with the support of Roots Sage 10

2022 Edition - inRage theme This version of the theme is compatible with the Full site editing of Wordpress 5.8/5.9 and use Sage 10 in order to manage

inRage 5 Jan 3, 2023
An open-source Minecraft: Java Edition server implementation, written in PHP.

PHPCraft An open-source Minecraft: Java Edition server implementation, written in PHP. What is PHPCraft? PHPCraft is an open-source Minecraft: Java Ed

Karen/あけみ 17 Dec 31, 2022
Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.

OpenMage 782 Jan 3, 2023
Deutsches Sprachpaket für Magento 2 Community Edition

Magento 2 German LocalePack de_DE Deutsches Sprachpaket für Magento 2 Community Edition (Version 2.4.2) Die Übersetzung wurde von deutschen Mutterspra

Splendid Internet GmbH 87 Sep 25, 2022
CodeFever Community Edition (A Self-hosted Git Services)

CodeFever Community Edition (A Self-hosted Git Services)

PGYER 2.3k Jan 7, 2023
SteadFast3 Minecraft: Bedrock Edition Server Software

Steadfast3 is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

null 5 May 21, 2022
A PHP library for all things Minecraft: Java Edition

Phpcraft A PHP library for all things Minecraft: Java Edition. This project has been abandoned! The limited subset of 1.8.x - 1.15.x that has been imp

null 16 Nov 29, 2022
CoarseMC Minecraft: Bedrock Edition Server Software

CoarseMC is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

null 5 May 21, 2022
A MCPE server software that backporting new Minecraft: Bedrock Edition to older PocketMine versions with better stability and performance.

CoarseMC is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

null 5 May 21, 2022
A server software for Minecraft: Bedrock Edition in PHP

A server software for Minecraft: BE. This is a SPOON of PocketMine-MP Getting started Documentation Installation instructions Docker image Plugin repo

WolfMC 7 Jul 14, 2022
This shell script and PHP file create a browseable HTML site from the Zig standard library source.

Browseable Zig standard library This shell script and PHP file create a browseable HTML site from the Zig standard library source. The idea is to inve

Dave Gauer 3 Mar 20, 2022
Magento 1.x Coding Standard

Magento Extension Quality Program Coding Standard ⚠️ Versions 3.0.0 and above of the MEQP Coding Standard are for Magento 1.x code only. To check Mage

Magento 224 Nov 29, 2022
Magento Coding Standard

Magento Coding Standard A set of Magento rules for PHP_CodeSniffer tool. Installation within a Magento 2 site To use within your Magento 2 project you

Magento 290 Dec 31, 2022