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

Commit 819f73a

Browse files
committed
Merge branch 'release-0.7.9'
2 parents 133361a + da9a76c commit 819f73a

File tree

113 files changed

+1280
-6761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1280
-6761
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
.DS_Store
22
public/*
33
source/*
4-
!public/listeners/*
5-
!public/styleguide/*
6-
!public/patterns/**/*
7-
!public/data/*.js
84
config.ini
95
latest-change.txt
106
*-ck.js
7+
*.sass-cache/

CHANGELOG

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.
22

3+
PL-v0.7.9
4+
- ADD: .sass-cache now ignored by default
5+
- ADD: configuration options to disable loading of page follow & auto-reload
6+
- ADD: configuration option to set cacheBuster to 0
7+
- ADD: configuration option to enable QR code feature
8+
- ADD: configuration option to set minimum & maximum widths for the viewport resizer
9+
- ADD: command line flag for generating only the patterns
10+
- ADD: command line flag to set cacheBuster to 0
11+
- ADD: better handling of missing required directories in public/
12+
- ADD: added a styleguide-specific.css to better manage classes
13+
- FIX: updated the console help output
14+
- FIX: removed everything in public/ except the README
15+
- FIX: removed the CDN version of jQuery
16+
- FIX: toolbar styles updated
17+
- FIX: icon font for the toolbar is no longer influencing the icon font of the patterns
18+
- FIX: updated the styles for the "find a pattern" field
19+
- FIX: code/annotations views now properly hide on resizing
20+
- FIX: states.css removed and those styles loaded into styleguide.css
21+
- FIX: default images updated
22+
- FIX: removed hay mode from the tool bar by default. can be added back in by editing config.ini
23+
- FIX: general pattern clean-up and re-styling to better match pattern lab's capabilities
24+
- THX: thanks to @illepic for the .sass-cache PR
25+
326
PL-v0.7.8
427
- ADD: can show annotations on view-all pages by default
528
- FIX: can target pattern divs and apply annotations

README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,58 @@
11
## About the PHP Version of Pattern Lab
22

3-
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.
3+
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.
44

55
## Demo
66

7-
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).
7+
You can play with a demo of the front-end of Pattern Lab at [demo.patternlab.io](http://demo.patternlab.io).
88

99
## Getting Started
1010

11-
The PHP version of Pattern Lab should be relatively easy for anyone to get up and running.
12-
13-
* [Requirements](http://pattern-lab.info/docs/requirements.html)
14-
* [Installing the PHP Version of Pattern Lab](http://pattern-lab.info/docs/installation.html)
15-
* [Upgrading the PHP Version of Pattern Lab](http://pattern-lab.info/docs/upgrading.html)
16-
* [Generating the Pattern Lab Website for the First Time](http://pattern-lab.info/docs/first-run.html)
17-
* [Editing the Pattern Lab Website Source Files](http://pattern-lab.info/docs/editing-source-files.html)
18-
* [Using the Command-line Options](http://pattern-lab.info/docs/command-line.html)
19-
* [Command Prompt on Windows](http://pattern-lab.info/docs/command-prompt-windows.html)
11+
* [Requirements](http://patternlab.io/docs/requirements.html)
12+
* [Installing the PHP Version of Pattern Lab](http://patternlab.io/docs/installation.html)
13+
* [Upgrading the PHP Version of Pattern Lab](http://patternlab.io/docs/upgrading.html)
14+
* [Generating the Pattern Lab Website for the First Time](http://patternlab.io/docs/first-run.html)
15+
* [Editing the Pattern Lab Website Source Files](http://patternlab.io/docs/editing-source-files.html)
16+
* [Using the Command-line Options](http://patternlab.io/docs/command-line.html)
17+
* [Command Prompt on Windows](http://patternlab.io/docs/command-prompt-windows.html)
2018

2119
## Working with Patterns
2220

2321
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.
2422

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

3836
## Creating & Working With Dynamic Data for a Pattern
3937

40-
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.
38+
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.
4139

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

4745
## Using Pattern Lab's Advanced Features
4846

49-
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:
50-
51-
* [Watching for Changes and Auto-Regenerating Patterns](http://pattern-lab.info/docs/advanced-auto-regenerate.html)
52-
* [Auto-Reloading the Browser Window When Changes Are Made](http://pattern-lab.info/docs/advanced-reload-browser.html)
53-
* [Multi-browser & Multi-device Testing with Page Follow](http://pattern-lab.info/docs/advanced-page-follow.html)
54-
* [Keyboard Shortcuts](http://pattern-lab.info/docs/advanced-keyboard-shortcuts.html)
55-
* [Special Pattern Lab-specific Query String Variables ](http://pattern-lab.info/docs/pattern-linking.html)
56-
* [Preventing the Cleaning of public/](http://pattern-lab.info/docs/advanced-clean-public.html)
57-
* [Generating CSS](http://pattern-lab.info/docs/advanced-generating-css.html)
58-
* [Modifying the Pattern Lab Nav](http://pattern-lab.info/docs/advanced-pattern-lab-nav.html)
59-
* [Integration with Compass](http://pattern-lab.info/docs/advanced-integration-with-compass.html)
47+
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:
48+
49+
* [Watching for Changes and Auto-Regenerating Patterns](http://patternlab.io/docs/advanced-auto-regenerate.html)
50+
* [Auto-Reloading the Browser Window When Changes Are Made](http://patternlab.io/docs/advanced-reload-browser.html)
51+
* [Multi-browser & Multi-device Testing with Page Follow](http://patternlab.io/docs/advanced-page-follow.html)
52+
* [Keyboard Shortcuts](http://patternlab.io/docs/advanced-keyboard-shortcuts.html)
53+
* [Special Pattern Lab-specific Query String Variables ](http://patternlab.io/docs/pattern-linking.html)
54+
* [Preventing the Cleaning of public/](http://patternlab.io/docs/advanced-clean-public.html)
55+
* [Generating CSS](http://patternlab.io/docs/advanced-generating-css.html)
56+
* [Modifying the Pattern Lab Nav](http://patternlab.io/docs/advanced-pattern-lab-nav.html)
57+
* [Editing the config.ini Options](http://patternlab.io/docs/advanced-config-options.html)
58+
* [Integration with Compass](http://patternlab.io/docs/advanced-integration-with-compass.html)

core/builder.php

Lines changed: 75 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,12 @@
66
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
77
* Licensed under the MIT license
88
*
9-
* Usage:
10-
*
11-
* php builder.php -g
12-
* Iterates over the 'source' directories & files and generates the entire site a single time.
13-
* It also cleans the 'public' directory.
14-
*
15-
* php builder/builder.php -gc
16-
* In addition to the -g flag features it will also generate CSS for each pattern. Resource instensive.
17-
*
18-
* php builder.php -w
19-
* Generates the site like the -g flag and then watches for changes in the 'source' directories &
20-
* files. Will re-generate files if they've changed.
21-
*
22-
* php builder.php -wr
23-
* In addition to the -w flag features it will also automatically start the auto-reload server.
24-
*
25-
* php builder.php -v
26-
* Prints out the current version of Pattern Lab.
27-
*
289
*/
2910

11+
/*******************************
12+
* General Set-up
13+
*******************************/
14+
3015
// check to see if json_decode exists. might be disabled in installs of PHP 5.5
3116
if (!function_exists("json_decode")) {
3217
print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
@@ -43,75 +28,89 @@
4328
$loader->setNamespaceSeparator("_");
4429
$loader->register();
4530

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

52-
// grab the arguments from the command line
53-
$args = getopt("gwcrv");
32+
/*******************************
33+
* Console Set-up
34+
*******************************/
5435

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

59-
// show the version of Pattern Lab
60-
if (isset($args["v"])) {
61-
print "You're running v".$config["v"]." of the PHP version of Pattern Lab.\n";
62-
exit;
63-
}
38+
// set-up the generate command and options
39+
$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/");
40+
$console->setCommandOption("g","p","patternsonly","Generate only the patterns. Does NOT clean public/.","To generate only the patterns:");
41+
$console->setCommandOption("g","n","nocache","Set the cacheBuster value to 0.","To turn off the cacheBuster:");
42+
$console->setCommandOption("g","c","enablecss","Generate CSS for each pattern. Resource intensive.","To run and generate the CSS for each pattern:");
6443

65-
// generate the pattern lab site if appropriate
66-
if (isset($args["g"]) || isset($args["w"])) {
67-
68-
$g = new PatternLab\Generator($config);
69-
$c = false;
44+
// set-up an alias for the generate command
45+
$console->setCommand("b","build","Alias for the generate command","Alias for the generate command. Please refer to it's help for full options.");
46+
47+
// set-up the watch command and options
48+
$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.");
49+
$console->setCommandOption("w","p","patternsonly","Watches only the patterns. Does NOT clean public/.","To watch and generate only the patterns:");
50+
$console->setCommandOption("w","n","nocache","Set the cacheBuster value to 0.","To turn off the cacheBuster:");
51+
$console->setCommandOption("w","r","autoreload","Turn on the auto-reload service.","To turn on auto-reload:");
52+
53+
// set-up the version command
54+
$console->setCommand("v","version","Print the version number","The version command prints out the current version of Pattern Lab.");
55+
56+
57+
/*******************************
58+
* Figure out what to run
59+
*******************************/
60+
61+
// get what was passed on the command line
62+
$console->getArguments();
63+
64+
if ($console->findCommand("h|help") && ($command = $console->getCommand())) {
7065

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

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

78-
// have some fun
79-
if (!isset($args["w"])) {
80-
$g->printSaying();
81-
}
71+
// run commands
8272

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

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

91-
if (isset($args["r"])) {
92-
$a = true;
83+
if (($command == "g") || ($command == "b")) {
84+
85+
// load the generator
86+
$g = new PatternLab\Generator($config);
87+
$g->generate($enableCSS,$moveStatic,$noCacheBuster);
88+
$g->printSaying();
89+
90+
} else if ($command == "w") {
91+
92+
// CSS feature should't be used with watch
93+
$enableCSS = false;
94+
95+
// load the generator
96+
$g = new PatternLab\Generator($config);
97+
$g->generate($enableCSS,$moveStatic,$noCacheBuster);
98+
99+
// load the watcher
100+
$w = new PatternLab\Watcher($config);
101+
$w->watch($autoReload,$moveStatic,$noCacheBuster);
102+
103+
} else if ($command == "v") {
104+
105+
// write out the version number
106+
print "You're running v".$config["v"]." of the PHP version of Pattern Lab.\n";
107+
exit;
108+
93109
}
94110

95-
$w->watch($a);
96-
97-
}
98-
99-
// when in doubt write out the usage
100-
if (!isset($args["g"]) && !isset($args["w"]) && !isset($args["v"])) {
111+
} else {
101112

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

117116
}

core/config/config.ini.default

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,41 @@
33
* If config.ini doesn't exist Pattern Lab will try to create a new version
44
*/
55

6-
v = "0.7.8"
6+
v = "0.7.9"
77

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

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

14-
// choose which ports the websocket services should run on
14+
// choose if these services should be loaded in the nav and their ports
15+
autoReloadNav = "true"
1516
autoReloadPort = "8002"
17+
pageFollowNav = "true"
1618
pageFollowPort = "8003"
1719

20+
// whether the qr code generator should be loaded automatically in the nav
21+
qrCodeGeneratorOn = "false"
22+
23+
// pattern lab's xip host if you have it configured, to be used with the QR code generator
24+
xipHostname = "http://patternlab.*.xip.io"
25+
1826
// whether the public directory should be cleaned when generating your site
1927
cleanPublic = "true"
2028

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

24-
// which, if any, controls to hide in the nav
25-
ishControlsHide = ""
33+
// which, if any, controls to hide in the nav, separate with a comma
34+
ishControlsHide = "hay"
2635

27-
// the order of pattern states
36+
// the order of pattern states, css class names
2837
patternStates = "inprogress,inreview,complete"
2938

30-
// the pattern types that shouldn't be included in the style guide
31-
styleGuideExcludes = ""
39+
// the pattern types that shouldn't be included in the style guide, useful if you nest pages/templates
40+
styleGuideExcludes = ""
41+
42+
// should the cache buster be on, set to false to set the cacheBuster value to 0
43+
cacheBusterOn = "true"

0 commit comments

Comments
 (0)