Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release-0.7.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolsen committed Mar 18, 2014
2 parents 133361a + da9a76c commit 819f73a
Show file tree
Hide file tree
Showing 113 changed files with 1,280 additions and 6,761 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
.DS_Store
public/*
source/*
!public/listeners/*
!public/styleguide/*
!public/patterns/**/*
!public/data/*.js
config.ini
latest-change.txt
*-ck.js
*.sass-cache/
23 changes: 23 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-v0.7.9
- ADD: .sass-cache now ignored by default
- ADD: configuration options to disable loading of page follow & auto-reload
- ADD: configuration option to set cacheBuster to 0
- ADD: configuration option to enable QR code feature
- ADD: configuration option to set minimum & maximum widths for the viewport resizer
- ADD: command line flag for generating only the patterns
- ADD: command line flag to set cacheBuster to 0
- ADD: better handling of missing required directories in public/
- ADD: added a styleguide-specific.css to better manage classes
- FIX: updated the console help output
- FIX: removed everything in public/ except the README
- FIX: removed the CDN version of jQuery
- FIX: toolbar styles updated
- FIX: icon font for the toolbar is no longer influencing the icon font of the patterns
- FIX: updated the styles for the "find a pattern" field
- FIX: code/annotations views now properly hide on resizing
- FIX: states.css removed and those styles loaded into styleguide.css
- FIX: default images updated
- FIX: removed hay mode from the tool bar by default. can be added back in by editing config.ini
- FIX: general pattern clean-up and re-styling to better match pattern lab's capabilities
- THX: thanks to @illepic for the .sass-cache PR

PL-v0.7.8
- ADD: can show annotations on view-all pages by default
- FIX: can target pattern divs and apply annotations
Expand Down
77 changes: 38 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,58 @@
## About the PHP Version of Pattern Lab

The PHP version of Pattern Lab is, at its core, a static site generator. It combines platform-agnostic assets, like the [Mustache](http://mustache.github.io/)-based patterns and the JavaScript-based viewer, with a PHP-based "builder" that transforms and dynamically builds the Pattern Lab site. By making it a static site generator, the PHP version of Pattern Lab strongly separates patterns, data, and presentation from build logic. The PHP version should be seen as a reference for other developers to improve upon as they build their own Pattern Lab Builders in their language of choice.
The PHP version of Pattern Lab is, at its core, a static site generator. It combines platform-agnostic assets, like the [Mustache](http://mustache.github.io/)-based patterns and the JavaScript-based viewer, with a PHP-based "builder" that transforms and dynamically builds the Pattern Lab site. By making it a static site generator, Pattern Lab strongly separates patterns, data, and presentation from build logic.

## Demo

You can play with a demo of the front-end of the PHP version of Pattern Lab at [demo.pattern-lab.info](http://demo.pattern-lab.info).
You can play with a demo of the front-end of Pattern Lab at [demo.patternlab.io](http://demo.patternlab.io).

## Getting Started

The PHP version of Pattern Lab should be relatively easy for anyone to get up and running.

* [Requirements](http://pattern-lab.info/docs/requirements.html)
* [Installing the PHP Version of Pattern Lab](http://pattern-lab.info/docs/installation.html)
* [Upgrading the PHP Version of Pattern Lab](http://pattern-lab.info/docs/upgrading.html)
* [Generating the Pattern Lab Website for the First Time](http://pattern-lab.info/docs/first-run.html)
* [Editing the Pattern Lab Website Source Files](http://pattern-lab.info/docs/editing-source-files.html)
* [Using the Command-line Options](http://pattern-lab.info/docs/command-line.html)
* [Command Prompt on Windows](http://pattern-lab.info/docs/command-prompt-windows.html)
* [Requirements](http://patternlab.io/docs/requirements.html)
* [Installing the PHP Version of Pattern Lab](http://patternlab.io/docs/installation.html)
* [Upgrading the PHP Version of Pattern Lab](http://patternlab.io/docs/upgrading.html)
* [Generating the Pattern Lab Website for the First Time](http://patternlab.io/docs/first-run.html)
* [Editing the Pattern Lab Website Source Files](http://patternlab.io/docs/editing-source-files.html)
* [Using the Command-line Options](http://patternlab.io/docs/command-line.html)
* [Command Prompt on Windows](http://patternlab.io/docs/command-prompt-windows.html)

## Working with Patterns

Patterns are the core element of Pattern Lab. Understanding how they work is the key to getting the most out of the system. Patterns use [Mustache](http://mustache.github.io/) so please read [Mustache's docs](http://mustache.github.io/mustache.5.html) as well.

* [How Patterns Are Organized](http://pattern-lab.info/docs/pattern-organization.html)
* [Adding New Patterns](http://pattern-lab.info/docs/pattern-add-new.html)
* [Reorganizing Patterns](http://pattern-lab.info/docs/pattern-reorganizing.html)
* [Including One Pattern Within Another via Partials](http://pattern-lab.info/docs/pattern-including.html)
* [Managing Assets for a Pattern: JavaScript, images, CSS, etc.](http://pattern-lab.info/docs/pattern-managing-assets.html)
* [Modifying the Pattern Header and Footer](http://pattern-lab.info/docs/pattern-header-footer.html)
* [Using Pseudo-Patterns](http://pattern-lab.info/docs/pattern-pseudo-patterns.html)
* [Using Pattern Parameters](http://pattern-lab.info/docs/pattern-parameters.html)
* [Using Pattern State](http://pattern-lab.info/docs/pattern-states.html)
* ["Hiding" Patterns in the Navigation](http://pattern-lab.info/docs/pattern-hiding.html)
* [Adding Annotations](http://pattern-lab.info/docs/pattern-adding-annotations.html)
* [Viewing Patterns on a Mobile Device](http://pattern-lab.info/docs/pattern-mobile-view.html)
* [How Patterns Are Organized](http://patternlab.io/docs/pattern-organization.html)
* [Adding New Patterns](http://patternlab.io/docs/pattern-add-new.html)
* [Reorganizing Patterns](http://patternlab.io/docs/pattern-reorganizing.html)
* [Including One Pattern Within Another via Partials](http://patternlab.io/docs/pattern-including.html)
* [Managing Assets for a Pattern: JavaScript, images, CSS, etc.](http://patternlab.io/docs/pattern-managing-assets.html)
* [Modifying the Pattern Header and Footer](http://patternlab.io/docs/pattern-header-footer.html)
* [Using Pseudo-Patterns](http://patternlab.io/docs/pattern-pseudo-patterns.html)
* [Using Pattern Parameters](http://patternlab.io/docs/pattern-parameters.html)
* [Using Pattern State](http://patternlab.io/docs/pattern-states.html)
* ["Hiding" Patterns in the Navigation](http://patternlab.io/docs/pattern-hiding.html)
* [Adding Annotations](http://patternlab.io/docs/pattern-adding-annotations.html)
* [Viewing Patterns on a Mobile Device](http://patternlab.io/docs/pattern-mobile-view.html)

## Creating & Working With Dynamic Data for a Pattern

The PHP version of Pattern Lab utilizes Mustache as the template language for patterns. In addition to allowing for the [inclusion of one pattern within another](https://github.com/pattern-lab/patternlab-php/wiki/Including-One-Pattern-Within-Another) it also gives pattern developers the ability to include variables. This means that attributes like image sources can be centralized in one file for easy modification across one or more patterns. The PHP version of Pattern Lab uses a JSON file, `source/_data/data.json`, to centralize many of these attributes.
The PHP version of Pattern Lab utilizes Mustache as the template language for patterns. In addition to allowing for the [inclusion of one pattern within another](http://patternlab.io/docs/pattern-including.html) it also gives pattern developers the ability to include variables. This means that attributes like image sources can be centralized in one file for easy modification across one or more patterns. The PHP version of Pattern Lab uses a JSON file, `source/_data/data.json`, to centralize many of these attributes.

* [Introduction to JSON & Mustache Variables](http://pattern-lab.info/docs/data-json-mustache.html)
* [Overriding the Central `data.json` Values with Pattern-specific Values](http://pattern-lab.info/docs/data-pattern-specific.html)
* [Linking to Patterns with Pattern Lab's Default `link` Variable](http://pattern-lab.info/docs/data-link-variable.html)
* [Creating Lists with Pattern Lab's Default `listItems` Variable](http://pattern-lab.info/docs/data-listitems.html)
* [Introduction to JSON & Mustache Variables](http://patternlab.io/docs/data-json-mustache.html)
* [Overriding the Central `data.json` Values with Pattern-specific Values](http://patternlab.io/docs/data-pattern-specific.html)
* [Linking to Patterns with Pattern Lab's Default `link` Variable](http://patternlab.io/docs/data-link-variable.html)
* [Creating Lists with Pattern Lab's Default `listItems` Variable](http://patternlab.io/docs/data-listitems.html)

## Using Pattern Lab's Advanced Features

By default, the Pattern Lab assets can be manually generated and the Pattern Lab site manually refreshed but who wants to waste time doing that? Here are some ways that the PHP version of Pattern Lab can make your development workflow a little smoother:

* [Watching for Changes and Auto-Regenerating Patterns](http://pattern-lab.info/docs/advanced-auto-regenerate.html)
* [Auto-Reloading the Browser Window When Changes Are Made](http://pattern-lab.info/docs/advanced-reload-browser.html)
* [Multi-browser & Multi-device Testing with Page Follow](http://pattern-lab.info/docs/advanced-page-follow.html)
* [Keyboard Shortcuts](http://pattern-lab.info/docs/advanced-keyboard-shortcuts.html)
* [Special Pattern Lab-specific Query String Variables ](http://pattern-lab.info/docs/pattern-linking.html)
* [Preventing the Cleaning of public/](http://pattern-lab.info/docs/advanced-clean-public.html)
* [Generating CSS](http://pattern-lab.info/docs/advanced-generating-css.html)
* [Modifying the Pattern Lab Nav](http://pattern-lab.info/docs/advanced-pattern-lab-nav.html)
* [Integration with Compass](http://pattern-lab.info/docs/advanced-integration-with-compass.html)
By default, the Pattern Lab assets can be manually generated and the Pattern Lab site manually refreshed but who wants to waste time doing that? Here are some ways that Pattern Lab can make your development workflow a little smoother:

* [Watching for Changes and Auto-Regenerating Patterns](http://patternlab.io/docs/advanced-auto-regenerate.html)
* [Auto-Reloading the Browser Window When Changes Are Made](http://patternlab.io/docs/advanced-reload-browser.html)
* [Multi-browser & Multi-device Testing with Page Follow](http://patternlab.io/docs/advanced-page-follow.html)
* [Keyboard Shortcuts](http://patternlab.io/docs/advanced-keyboard-shortcuts.html)
* [Special Pattern Lab-specific Query String Variables ](http://patternlab.io/docs/pattern-linking.html)
* [Preventing the Cleaning of public/](http://patternlab.io/docs/advanced-clean-public.html)
* [Generating CSS](http://patternlab.io/docs/advanced-generating-css.html)
* [Modifying the Pattern Lab Nav](http://patternlab.io/docs/advanced-pattern-lab-nav.html)
* [Editing the config.ini Options](http://patternlab.io/docs/advanced-config-options.html)
* [Integration with Compass](http://patternlab.io/docs/advanced-integration-with-compass.html)
151 changes: 75 additions & 76 deletions core/builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,12 @@
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
* Usage:
*
* php builder.php -g
* Iterates over the 'source' directories & files and generates the entire site a single time.
* It also cleans the 'public' directory.
*
* php builder/builder.php -gc
* In addition to the -g flag features it will also generate CSS for each pattern. Resource instensive.
*
* php builder.php -w
* Generates the site like the -g flag and then watches for changes in the 'source' directories &
* files. Will re-generate files if they've changed.
*
* php builder.php -wr
* In addition to the -w flag features it will also automatically start the auto-reload server.
*
* php builder.php -v
* Prints out the current version of Pattern Lab.
*
*/

/*******************************
* General Set-up
*******************************/

// check to see if json_decode exists. might be disabled in installs of PHP 5.5
if (!function_exists("json_decode")) {
print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
Expand All @@ -43,75 +28,89 @@
$loader->setNamespaceSeparator("_");
$loader->register();

// make sure this script is being accessed from the command line
if (php_sapi_name() != 'cli') {
print "The builder script can only be run from the command line.\n";
exit;
}

// grab the arguments from the command line
$args = getopt("gwcrv");
/*******************************
* Console Set-up
*******************************/

// load Pattern Lab's config, if first time set-up move files appropriately too
$co = new PatternLab\Configurer;
$config = $co->getConfig();
$console = new PatternLab\Console;

// show the version of Pattern Lab
if (isset($args["v"])) {
print "You're running v".$config["v"]." of the PHP version of Pattern Lab.\n";
exit;
}
// set-up the generate command and options
$console->setCommand("g","generate","Generate Pattern Lab","The generate command generates an entire site a single time. By default it removes old content in public/, compiles the patterns and moves content from source/ into public/");
$console->setCommandOption("g","p","patternsonly","Generate only the patterns. Does NOT clean public/.","To generate only the patterns:");
$console->setCommandOption("g","n","nocache","Set the cacheBuster value to 0.","To turn off the cacheBuster:");
$console->setCommandOption("g","c","enablecss","Generate CSS for each pattern. Resource intensive.","To run and generate the CSS for each pattern:");

// generate the pattern lab site if appropriate
if (isset($args["g"]) || isset($args["w"])) {

$g = new PatternLab\Generator($config);
$c = false;
// set-up an alias for the generate command
$console->setCommand("b","build","Alias for the generate command","Alias for the generate command. Please refer to it's help for full options.");

// set-up the watch command and options
$console->setCommand("w","watch","Watch for changes and regenerate","The watch command builds Pattern Lab, watches for changes in source/ and regenerates Pattern Lab when there are any.");
$console->setCommandOption("w","p","patternsonly","Watches only the patterns. Does NOT clean public/.","To watch and generate only the patterns:");
$console->setCommandOption("w","n","nocache","Set the cacheBuster value to 0.","To turn off the cacheBuster:");
$console->setCommandOption("w","r","autoreload","Turn on the auto-reload service.","To turn on auto-reload:");

// set-up the version command
$console->setCommand("v","version","Print the version number","The version command prints out the current version of Pattern Lab.");


/*******************************
* Figure out what to run
*******************************/

// get what was passed on the command line
$console->getArguments();

if ($console->findCommand("h|help") && ($command = $console->getCommand())) {

// check to see if CSS for patterns should be parsed & outputted
if (isset($args["c"]) && !isset($args["w"])) {
$c = true;
}
// write the usage & help for a specific command
$console->writeHelpCommand($command);

$g->generate($c);
} else if ($command = $console->getCommand()) {

// have some fun
if (!isset($args["w"])) {
$g->printSaying();
}
// run commands

}

// watch the source directory and regenerate any changed files
if (isset($args["w"])) {
// load Pattern Lab's config, if first time set-up move files appropriately too
$configurer = new PatternLab\Configurer;
$config = $configurer->getConfig();

$w = new PatternLab\Watcher($config);
$a = false;
// set-up required vars
$enableCSS = ($console->findCommandOption("c|enablecss")) ? true : false;
$moveStatic = ($console->findCommandOption("p|patternsonly")) ? false : true;
$noCacheBuster = ($console->findCommandOption("n|nocache")) ? true : false;
$autoReload = ($console->findCommandOption("r|autoreload")) ? true : false;

if (isset($args["r"])) {
$a = true;
if (($command == "g") || ($command == "b")) {

// load the generator
$g = new PatternLab\Generator($config);
$g->generate($enableCSS,$moveStatic,$noCacheBuster);
$g->printSaying();

} else if ($command == "w") {

// CSS feature should't be used with watch
$enableCSS = false;

// load the generator
$g = new PatternLab\Generator($config);
$g->generate($enableCSS,$moveStatic,$noCacheBuster);

// load the watcher
$w = new PatternLab\Watcher($config);
$w->watch($autoReload,$moveStatic,$noCacheBuster);

} else if ($command == "v") {

// write out the version number
print "You're running v".$config["v"]." of the PHP version of Pattern Lab.\n";
exit;

}

$w->watch($a);

}

// when in doubt write out the usage
if (!isset($args["g"]) && !isset($args["w"]) && !isset($args["v"])) {
} else {

print "\n";
print "Usage:\n\n";
print " php ".$_SERVER["PHP_SELF"]." -g\n";
print " Iterates over the 'source' directories & files and generates the entire site a single time.\n";
print " It also cleans the 'public' directory.\n\n";
print " php ".$_SERVER["PHP_SELF"]." -gc\n";
print " In addition to the -g flag features it will also generate CSS for each pattern. Resource instensive.\n\n";
print " php ".$_SERVER["PHP_SELF"]." -w\n";
print " Generates the site like the -g flag and then watches for changes in the 'source' directories &\n";
print " files. Will re-generate files if they've changed.\n\n";
print " php ".$_SERVER["PHP_SELF"]." -wr\n";
print " In addition to the -w flag features it will also automatically start the auto-reload server.\n\n";
print " php ".$_SERVER["PHP_SELF"]." -v\n";
print " Prints out the current version of Pattern Lab.\n\n";
// write the generic help
$console->writeHelp();

}
32 changes: 22 additions & 10 deletions core/config/config.ini.default
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,41 @@
* If config.ini doesn't exist Pattern Lab will try to create a new version
*/

v = "0.7.8"
v = "0.7.9"

// file extensions to ignore when building or watching the source dir, separate with a comma
ie = "scss,DS_Store,less"

// directories and files to ignore when building or watching the source dir, separate with a comma
id = "scss,.svn"
id = "scss,.svn,.sass-cache"

// choose which ports the websocket services should run on
// choose if these services should be loaded in the nav and their ports
autoReloadNav = "true"
autoReloadPort = "8002"
pageFollowNav = "true"
pageFollowPort = "8003"

// whether the qr code generator should be loaded automatically in the nav
qrCodeGeneratorOn = "false"

// pattern lab's xip host if you have it configured, to be used with the QR code generator
xipHostname = "http://patternlab.*.xip.io"

// whether the public directory should be cleaned when generating your site
cleanPublic = "true"

// pattern lab's xip host if you have it configured
xipHostname = "http://patternlab.*.xip.io"
// the minimum and maximum for the viewport resizer
ishMinimum = "240"
ishMaximum = "2600"

// which, if any, controls to hide in the nav
ishControlsHide = ""
// which, if any, controls to hide in the nav, separate with a comma
ishControlsHide = "hay"

// the order of pattern states
// the order of pattern states, css class names
patternStates = "inprogress,inreview,complete"

// the pattern types that shouldn't be included in the style guide
styleGuideExcludes = ""
// the pattern types that shouldn't be included in the style guide, useful if you nest pages/templates
styleGuideExcludes = ""

// should the cache buster be on, set to false to set the cacheBuster value to 0
cacheBusterOn = "true"
Loading

0 comments on commit 819f73a

Please sign in to comment.