Skip to content

Commit 1dd42e3

Browse files
authored
Merge pull request #23 from phase2/Jwaxo-pl-additions
Add notes on PL Data structures and Demos
2 parents 89a469c + bb00114 commit 1dd42e3

File tree

4 files changed

+60
-12
lines changed

4 files changed

+60
-12
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2+
.DS_Store
23
.idea
34
build
45
site

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Particle is an opinionated set of tools and examples to:
88

99
## Particle Features
1010

11-
* Drupal theme, Grav theme, Pattern Lab instance
11+
* Drupal theme, Grav theme, [Pattern Lab](https://patternlab.io/docs/) instance
1212
* Strict [Atomic Design](http://atomicdesign.bradfrost.com/) component structure
1313
* Robust Webpack bundling of all CSS, JavaScript, font, and static assets for multiple targets
1414
* [Webpack Dev Server](https://github.com/webpack/webpack-dev-server) for local hosting and hot reloading of assets into Pattern Lab
@@ -21,6 +21,7 @@ Particle is an opinionated set of tools and examples to:
2121

2222
## Documentation To-Do List
2323

24+
* Go over basics of Pattern Lab, the specific way Particle has Pattern Lab set up by default, and suggested uses.
2425
* Folder & config structure need updated to current Webpack structure
2526
* Explain Particle.js and how the `Particle()` function smashes various Webpack configs together
2627
* Explain Webpack structure \(CSS modes, etc.\)

Diff for: particle/architecture/component-structure.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ npm run new
1010

1111
Follow the onscreen prompts for the location, included files, and name of the new component.
1212

13-
### For versions prior to v10.1.0:
14-
15-
**Then make sure you edit** `source/design-system.js` **and add your new component.** Versions after this should update next time you build.
16-
1713
## Anatomy of a Component
1814

1915
All components require a set of files:
@@ -41,6 +37,8 @@ Optionally, you can add a `__test__` folder to your components base directory \(
4137
├── ...
4238
```
4339

40+
## Importing Assets
41+
4442
With the power of Webpack, all static assets a component needs are `import`ed right into the `index.js` **entry point** alongside the JavaScript methods:
4543

4644
```javascript
@@ -77,3 +75,28 @@ export function enable($context) {
7775
export default enable;
7876
```
7977

78+
## Using Demos
79+
80+
Every component has an optional demo folder, which is automatically pulled into Pattern Lab. These files are only built for Pattern Lab, so you should never do work on them that you expect to see on a production app, such as a Drupal theme.
81+
82+
The Yeoman generator creates four files by default in this folder, which describe the general Phase2 way to demonstrate how to use a new component:
83+
84+
### index.js
85+
Describes to Webpack the files to include when generating the Pattern Lab demos. This most likely will only need to be touched when you are creating multiple demo pages for a single component.
86+
87+
### component.twig
88+
This should serve as an example twig file that shows an inclusion of the new pattern, placed with example variables and layouts so that it will appear like an intended component when viewed in the demos.
89+
90+
The default .twig file places a standard Twig-style `include` of your new component, but you can (and should) modify this page to meet your design system better. Look at the default patterns for good examples of how to create a demo template.
91+
92+
### component.md
93+
An additional readme that may describe how to use your demo, its implications, or others. By default the variables that a component requires are often documented here, in addition to in the component's _component.twig file.
94+
95+
### component.yml
96+
An optional way to override the data in `/_data/data.yml`, to display something specific in your demo. These data structures are only included in their respective page's demos when rendering the demo's template, so they are safely separated from other pattern demos.
97+
98+
Due to Particle including the [Faker plugin of Pattern Lab](https://github.com/pattern-lab/plugin-php-faker), you can use the [Node.JS Faker API](https://www.npmjs.com/package/faker) to generate random data to appear in your demos! See `/_data/data.yml` for examples.
99+
100+
**Note:** If you would like to create demo data to be global between all patterns, add the variables to a Yaml file in the `/_data` folder, such as `/_data/data.yml`.
101+
102+
For more information about how Pattern Lab expects variables to be added for use in patterns, see the [Pattern](https://patternlab.io/docs/data-overview.html) Lab docs.

Diff for: readme.md

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
1-
# Phase2's Front End Tooling Documentation (Particle & Friends)
1+
# Intro
22

3-
## live docs available [here](https://phase2.github.io/frontend-docs/)
3+
Particle is an opinionated set of tools and examples to:
44

5-
## to work on & edit locally:
5+
1. Build an application-agnostic **design system** made of assets like Twig, Sass, JavaScript, images, etc
6+
2. Apply that **design system** to a locally-served Pattern Lab for rapid prototyping
7+
3. Apply that **design system** to other consuming apps like, Drupal, Grav, or \(soon\) Wordpress
68

7-
pip install mkdocs
8-
mkdocs serve
9+
## Particle Features
910

10-
# published with:
11+
* Drupal theme, Grav theme, [Pattern Lab](https://patternlab.io/docs/) instance
12+
* Strict [Atomic Design](http://atomicdesign.bradfrost.com/) component structure
13+
* Robust Webpack bundling of all CSS, JavaScript, font, and static assets for multiple targets
14+
* [Webpack Dev Server](https://github.com/webpack/webpack-dev-server) for local hosting and hot reloading of assets into Pattern Lab
15+
* [Twig namespaced paths](https://symfony.com/doc/current/templating/namespaced_paths.html) automatically added into Drupal theme and Pattern Lab config; within any Twig file, `@atoms/thing.twig` means the same thing to Drupal theme and Pattern Lab
16+
* Iconfont auto-generation
17+
* Bootstrap 4 integration, used for all starting example components
18+
* Auto-linting against the [AirBnB JavaScript Style Guide](https://github.com/airbnb/javascript) and sane Sass standards
19+
* All Webpack and Gulp files are fully configurable
20+
* [PostCSS](https://github.com/postcss/postcss/blob/master/README.md) automation and expansion, with [Autoprefixer](https://github.com/postcss/autoprefixer/blob/master/README.md).
21+
22+
## Documentation To-Do List
23+
24+
* Go over basics of Pattern Lab, the specific way Particle has Pattern Lab set up by default, and suggested uses.
25+
* Folder & config structure need updated to current Webpack structure
26+
* Explain Particle.js and how the `Particle()` function smashes various Webpack configs together
27+
* Explain Webpack structure \(CSS modes, etc.\)
28+
* Expand on technologies Particle automatically includes to make Sass/JS faster.
29+
* Troubleshooting cleanup \("nothing to see here", datetime error?, etc.\)
30+
* Testing notes \(Jest, Pa11y, Cypress?\)
31+
* Vue-related notes
32+
* Example workflows
33+
* Flesh out the "thinking" sections
34+
* Update the Drupal apps section \(what goes here vs. Drupal under Frontend?\)
1135

12-
mkdocs gh-deploy

0 commit comments

Comments
 (0)