Skip to content

Commit 07bd754

Browse files
Brian Muenzenmeyergeoffp
authored andcommitted
Merge pull request #52 from pattern-lab/dev
PL Node 1.2
1 parent 0374cc3 commit 07bd754

Some content is hidden

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

42 files changed

+2979
-1060
lines changed

packages/patternengine-node-twig/.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: node_js
33
node_js:
44
- 0.11
55
- 0.10
6-
- 0.8
76

87
before_install:
98
- phantomjs --version
@@ -13,4 +12,5 @@ before_script:
1312

1413
branches:
1514
only:
16-
- master
15+
- master
16+
- dev

packages/patternengine-node-twig/CHANGELOG

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

3+
PL-node-v0.1.2
4+
- ADD: Abstracted template rendering into a function for easier swapping of rendering engine
5+
- ADD: Smarter filtering of files to support other templates Thanks
6+
- ADD: Help command line agument
7+
- ADD: Version command line argument
8+
- ADD: Patterns only command line argument
9+
- ADD: IshControlsVisible options. Can now hide any ishControls you like.
10+
- ADD: Documented the command line interface
11+
- CHG: Put debug flag in conf.json instead of package.json
12+
- CHG: Aligned styleguide css with patternlab-php
13+
- FIX: Removed node .8 from travis
14+
- FIX: Code and annotation support in patternlab viewer
15+
- THX: thanks @ivanmayes and Shoptology crew for contibutions!
16+
317
PL-node-v0.1.1
418
- FIX: Removed View All Pattern SubItem Link Logic, no longer in reference implementation
519
- ADD: Flag for generating debug file

packages/patternengine-node-twig/Gruntfile.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ module.exports = function(grunt) {
1010
concat: {
1111
options: {
1212
stripBanners: true,
13-
banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
13+
banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
1414
},
15-
dist: {
15+
patternlab: {
1616
src: './builder/patternlab.js',
1717
dest: './builder/patternlab.js'
18+
},
19+
object_factory: {
20+
src: './builder/object_factory.js',
21+
dest: './builder/object_factory.js'
1822
}
1923
},
2024
copy: {
@@ -68,17 +72,13 @@ module.exports = function(grunt) {
6872
}
6973
}
7074
},
71-
qunit: {
72-
all:{
73-
options:{
74-
urls: ['./test/tests.html']
75-
}
76-
}
75+
nodeunit: {
76+
all: ['test/*_tests.js']
7777
}
7878
});
7979

8080
// load all grunt tasks
81-
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
81+
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
8282

8383
//load the patternlab task
8484
grunt.task.loadTasks('./builder/');
@@ -87,5 +87,5 @@ module.exports = function(grunt) {
8787
grunt.registerTask('default', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy']);
8888

8989
//travis CI task
90-
grunt.registerTask('travis', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'qunit'])
90+
grunt.registerTask('travis', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'nodeunit']);
9191
};

packages/patternengine-node-twig/README.md

Lines changed: 67 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,91 @@ To run patternlab-node, just do the following from the command line at the root
1010
2. `npm install -g grunt-cli`
1111
3. `grunt`
1212

13-
This creates all patterns, the styleguide, and the pattern lab site. `patternlab.json` is a file created for debugging purposes. It tells you all the secrets in tidy json.
13+
This creates all patterns, the styleguide, and the pattern lab site.
1414

15+
### Command Line Interface
16+
17+
The following are grunt task arguments you may execute:
18+
19+
##### `patternlab`
20+
With no arguments, patternlab runs the full builder, compiling patterns, and constructing the front-end site.
21+
22+
##### `patternlab:only_patterns`
23+
Compile the patterns only, outputting to ./public/patterns
24+
25+
##### `patternlab:v`
26+
Retrieve the version of patternlab-node you have installed
27+
28+
##### `patternlab:help`
29+
Get more information about patternlab-node, pattern lab in general, and where to report issues.
30+
31+
### Config Options
32+
33+
##### Watching Changes
1534
To have patternlab-node watch for changes to either a mustache template, data, or stylesheets, run `grunt watch`. The `Gruntfile` governs what is watched. It should be easy to add scss or whatever preprocessor you fancy.
1635

36+
##### Nav Bar Controls
37+
If you don't have a need for some of the nav-bar tools in the patternlab frontend, you can turn them off in `config.json`.
38+
39+
The current selection is as follows. It reflects support versus patternlab-php.
40+
41+
```
42+
"ishControlsVisible": {
43+
"s": true,
44+
"m": true,
45+
"l": true,
46+
"full": true,
47+
"ranndom": true,
48+
"disco": true,
49+
"hay": true,
50+
"mqs": false,
51+
"find": false,
52+
"views-all": true,
53+
"views-annotations": true,
54+
"views-code": true,
55+
"views-new": true,
56+
"tools-all": true,
57+
"tools-follow": false,
58+
"tools-reload": false,
59+
"tools-shortcuts": false,
60+
"tools-docs": true
61+
}
62+
```
63+
64+
##### Verbose Mode
65+
`patternlab.json` is a file created for debugging purposes. Set `debug` to true in `.config.json` to see all the secrets.
66+
1767
### Under Active Development
1868

1969
[![Build Status](https://travis-ci.org/pattern-lab/patternlab-node.png?branch=master)](https://travis-ci.org/pattern-lab/patternlab-node) The Node version of Pattern Lab is under active development by [@bmuenzenmeyer](https://twitter.com/bmuenzenmeyer) and contributors. Pull requests welcome, but please take a moment to read the [guidelines](https://github.com/pattern-lab/patternlab-node/blob/master/CONTRIBUTING.md).
2070

21-
#### Forward, To the Specification!
71+
### Forward, To the Specification!
2272

2373
Dave Olsen has published the [specification](https://github.com/pattern-lab/the-spec/blob/draft/SPEC.md) for Pattern Lab ports. Development will be oriented toward compliance with this as the spec and the port mature together.
2474

25-
#### Is Pattern Lab a Platform or a Build Tool?
75+
### Is Pattern Lab a Platform or a Build Tool?
2676

2777
A lot of good conversation has revolved around whether Pattern Lab is a platform or a tool in the toolbox, part of a larger solution. It's my goal to #1) adhere to the specification and #2) meet the needs of both use cases.
2878

79+
If you want to only build the patterns, alter your `Gruntfile.js` patternlab task to the following:
2980

30-
**THE FOLLOWING IS FROM THE PATTERNLAB-PHP PROJECT. A LOT STILL APPLIES TO PATTERNLAB-NODE, BUT IT HAS NOT BEEN ADAPTED YET. USE AT YOUR OWN PERIL**
81+
```
82+
grunt.registerTask('default', ['clean', 'concat', 'patternlab:only_patterns', /*'sass',*/ 'copy']);
83+
```
3184

85+
This will output compiled patterns to ./public/patterns/
3286

3387
===
3488

35-
## Demo
89+
**THE FOLLOWING IS FROM THE PATTERNLAB-PHP PROJECT. A LOT STILL APPLIES TO PATTERNLAB-NODE, BUT IT HAS NOT BEEN ADAPTED YET. USE AT YOUR OWN PERIL**
90+
91+
===
92+
93+
### Demo
3694

3795
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).
3896

39-
## Getting Started
97+
### Getting Started
4098

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

@@ -46,7 +104,7 @@ The PHP version of Pattern Lab should be relatively easy for anyone to get up an
46104
* [Editing the Pattern Lab Website Source Files](https://github.com/pattern-lab/patternlab-php/wiki/Editing-the-Pattern-Lab-Website-Source-Files)
47105
* [Using the Command-line Options](https://github.com/pattern-lab/patternlab-php/wiki/Using-the-Command-line-Options)
48106

49-
## Working with Patterns
107+
### Working with Patterns
50108

51109
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.
52110

@@ -60,7 +118,7 @@ Patterns are the core element of Pattern Lab. Understanding how they work is the
60118
* [Managing Assets for a Pattern: JavaScript, images, CSS, etc.](https://github.com/pattern-lab/patternlab-php/wiki/Managing-Assets-for-a-Pattern)
61119
* [Modifying the Standard Header & Footer for Patterns](https://github.com/pattern-lab/patternlab-php/wiki/Modifying-the-Standard-Header-&-Footer-for-Patterns)
62120

63-
## Creating & Working With Dynamic Data for a Pattern
121+
### Creating & Working With Dynamic Data for a Pattern
64122

65123
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.
66124

@@ -69,7 +127,7 @@ The PHP version of Pattern Lab utilizes Mustache as the template language for pa
69127
* [Linking to Patterns with Pattern Lab's Default `link` Variable](https://github.com/pattern-lab/patternlab-php/wiki/Linking-to-Patterns-with-Pattern-Lab's-Default-%60link%60-Variable)
70128
* [Creating Lists with Pattern Lab's Default `listItems` Variable](https://github.com/pattern-lab/patternlab-php/wiki/Creating-Lists-with-Pattern-Lab's-Default-%60listItems%60-Variable)
71129

72-
## Using Pattern Lab's Advanced Features
130+
### Using Pattern Lab's Advanced Features
73131

74132
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:
75133

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* patternlab-node - v0.1.2 - 2014
3+
*
4+
* Brian Muenzenmeyer, and the web community.
5+
* Licensed under the MIT license.
6+
*
7+
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
8+
*
9+
*/
10+
11+
(function () {
12+
"use strict";
13+
14+
var oPattern = function(name, subdir, filename, data){
15+
this.name = name; //this is the unique name with the subDir
16+
this.subdir = subdir;
17+
this.filename = filename;
18+
this.data = data;
19+
this.template = '';
20+
this.patternPartial = '';
21+
this.patternName = ''; //this is the display name for the ui
22+
this.patternLink = '';
23+
this.patternGroup = name.substring(name.indexOf('-') + 1, name.indexOf('-', 4) + 1 - name.indexOf('-') + 1);
24+
this.patternSubGroup = subdir.substring(subdir.indexOf('/') + 4);
25+
this.flatPatternPath = subdir.replace(/\//g, '-');
26+
};
27+
28+
var oBucket = function(name){
29+
this.bucketNameLC = name;
30+
this.bucketNameUC = name.charAt(0).toUpperCase() + name.slice(1);
31+
this.navItems = [];
32+
this.navItemsIndex = [];
33+
this.patternItems = [];
34+
this.patternItemsIndex = [];
35+
};
36+
37+
var oNavItem = function(name){
38+
this.sectionNameLC = name;
39+
this.sectionNameUC = name.charAt(0).toUpperCase() + name.slice(1);
40+
this.navSubItems = [];
41+
this.navSubItemsIndex = [];
42+
};
43+
44+
var oNavSubItem = function(name){
45+
this.patternPath = '';
46+
this.patternPartial = '';
47+
this.patternName = name.charAt(0).toUpperCase() + name.slice(1);
48+
};
49+
50+
var oPatternItem = function(){
51+
this.patternPath = '';
52+
this.patternPartial = '';
53+
this.patternName = '';
54+
};
55+
56+
module.exports = {
57+
oPattern: oPattern,
58+
oBucket: oBucket,
59+
oNavItem: oNavItem,
60+
oNavSubItem: oNavSubItem,
61+
oPatternItem: oPatternItem
62+
};
63+
64+
}());
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(function () {
2+
"use strict";
3+
4+
5+
}());

0 commit comments

Comments
 (0)