padl v0.3.8-alpha.2
PaDL - Pattern Design Library System
Installation
npm i -g padlAbout
This is a project that allows you to easily create pattern libraries, with pure webcomponents using polymer (or lit). It bundles all of your components together with the needed polyfills so that you only require one js file.
Why use?
Padl does a few things that makes developing webcomponents easier:
- š Generates all the files that you need, when creating a pattern library and when creating a new component.
- š©āš» Creates a kickass development environment, using storybook.
- š Bundles and tree shakes all the needed files together.
Example structure
If we create a hello-world pattern library with a primary-button web component:
āā⬠hello-world
āā⬠src
| āā⬠primary-button
| āāā component.js
| āāā story.js
| āāā styles.less
āā⬠test
| āā⬠primary-button
| | āāā primary-button_test.js
| | āāā primary-button_test.html
| āāā index.html
āā⬠dist
āāā hello-world.min.js
āāā components.min.jsTo create this example:
npm i -g padl
padl new hello-world
cd hello-world && npm i
padl g primary-button
padl buildIntegration
As seen in the example, hello-world.min.js file is created.
This will add all the polyfills, components, lit-element and can inline your global styles. This is in an effort to reduce the amount of blocking, while keeping the file as small as possible.
Note:
Our browser coverage is last 2 browsers + IE11. For this reason we aren't moving forward with ES modules,
however with this setup it will allow us to start to look into how to implement.
How to
Create a new pattern library
padl new [name]Options
type: polymer, lit (default: polymer)
padl new [name] --type litAfter creating a new pattern library you can:
cd [name] && npm i
Create a new component
Inside your pattern library
padl g [component-name] This will create a polymer or lit component (based on your .padl type).
It will also generate the story.js, styles.less and the test files.
Delete a component
Inside your pattern library
padl d [component-name]Build your library
Inside your pattern library
padl buildIn your dist folder will find the components.min.js
Serve a component
Inside your pattern library
padl serve This will generate a storybook of all your component stories at localhost:9001
Options
port: 8080 (default: 9001)
padl serve --port 8080
Config file
- type polymer/lit (String, Default: polymer, prefilled on setup)
- watch (Object)
- watchGlob (Array)
- commands (Array)
- static (Array)
- globalStyle
- input (String)
- output (String)
- watch (String|Array|Glob)
{
"type": "lit",
"watch": {
"watchGlob": ["styles/**", "dist/*"],
"commands": ["npm run less:watch"]
},
"static": ["./styles/fonts"],
"globalStyle": {
"inline": true,
"input": "./styles/base/all.less",
"output": "./dist/styles.min.css",
"watch": "./styles/**"
}
}Test your components
Inside your pattern library
padl testOptions
- persistent (default: false)
- headless (default: false)
Persistent
padl test --persistent
padl test -pHeadless
For headless testing to work you need a config file in your project root called wct.headless.config.json.
An example of how this file could be:
{
"plugins": {
"local": {
"browsers": ["chrome", "firefox"],
"browserOptions": {
"chrome": [
"headless"
],
"firefox": [
"-headless"
]
}
}
}
} padl test --headless
padl test -hDependencies
This uses a variety of other resources:
- Lit Element
- Storybook
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago