@justeattakeaway/pie-css 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -1
- package/package.json +1 -1
- package/scss/helpers/_helpers.scss +9 -0
- package/scss/helpers/index.scss +1 -0
- package/scss/index.scss +1 -0
package/README.md
CHANGED
|
@@ -10,6 +10,117 @@
|
|
|
10
10
|
|
|
11
11
|
# PIE CSS
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
# Table of Contents
|
|
14
|
+
|
|
15
|
+
1. [Introduction](#pie-css)
|
|
16
|
+
2. [Installation](#installation)
|
|
17
|
+
1. JS or Framework import (via bundler)
|
|
18
|
+
2. NuxtJS
|
|
19
|
+
3. Sass /SCSS
|
|
20
|
+
4. Native HTML
|
|
21
|
+
3. [Using the PIE CSS – SCSS helpers](#helpers)
|
|
22
|
+
|
|
23
|
+
## Introduction
|
|
24
|
+
|
|
25
|
+
PIE CSS is A styling library that provides both a shared collection of ready to use CSS styles to be used across JET web front-ends, and SCSS-based style helpers for our PIE Web Component library.
|
|
14
26
|
|
|
15
27
|
---
|
|
28
|
+
|
|
29
|
+
## Installing PIE CSS shared CSS styles
|
|
30
|
+
|
|
31
|
+
To install the PIE CSS library, run the following on your command line:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# npm
|
|
35
|
+
npm i @justeattakeaway/pie-css
|
|
36
|
+
|
|
37
|
+
# yarn
|
|
38
|
+
yarn add @justeattakeaway/pie-css
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Once installed, how you include PIE CSS will largely depend on the type of application you are building (and your own preference), but here are a few examples.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### JS or Framework import (via bundler)
|
|
45
|
+
|
|
46
|
+
One common way of importing PIE CSS would be through a regular JS import as part of your application bundle.
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import '@justeattakeaway/pie-css';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
For example, in React (or NextJS), you could add the `pie-css` import to your `App.js` file:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import '@justeattakeaway/pie-css';
|
|
57
|
+
|
|
58
|
+
function App () {
|
|
59
|
+
return (
|
|
60
|
+
…
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default App;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Similarly, in Vue 3, you will likely include it as part of your `/src/main.ts` file:
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { createApp } from 'vue';
|
|
72
|
+
import '@justeattakeaway/pie-css';
|
|
73
|
+
import App from './App.vue';
|
|
74
|
+
|
|
75
|
+
createApp(App).mount('#app');
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### NuxtJS
|
|
79
|
+
|
|
80
|
+
If you are using NuxtJS, you can import PIE CSS in your `nuxt.config.js` file.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
For NuxtJS v3, this would look like this:
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
// Nuxt v3
|
|
87
|
+
export default defineNuxtConfig({
|
|
88
|
+
css: ['@justeattakeaway/pie-css'],
|
|
89
|
+
…
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For NuxtJS v2, it is very similar, looking more like this:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
export default {
|
|
97
|
+
css: [
|
|
98
|
+
'@justeattakeaway/pie-css',
|
|
99
|
+
],
|
|
100
|
+
…
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Sass / SCSS
|
|
106
|
+
|
|
107
|
+
If you are using Sass, you could import the CSS file as part of your styles directly.
|
|
108
|
+
|
|
109
|
+
```scss
|
|
110
|
+
@use 'node_modules/@justeattakeaway/pie-css/dist/index.css';
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Native HTML
|
|
115
|
+
|
|
116
|
+
Of course, you could include the styles straight inside your HTML document – most likely you'd want to link to the `/@justeattakeaway/pie-css/dist/index.css` CSS file in the head of your HTML.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Using the PIE CSS – SCSS helpers
|
|
121
|
+
|
|
122
|
+
PIE CSS also has an optional set of SCSS helpers that are used by the PIE Web Components.
|
|
123
|
+
|
|
124
|
+
These are for carrying out common tasks in our styles, such as setting font sizes in consistent ways and sharing styles across components via SCSS mixins and functions.
|
|
125
|
+
|
|
126
|
+
We will be writing more in-depth docs on these SCSS helpers shortly, but for now, feel free to browse the [SCSS code in the PIE mono-repo](https://github.com/justeattakeaway/pie/tree/main/packages/tools/pie-css/scss).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A styling library that provides both a shared collection of ready to use CSS styles to be used across JET web front-ends, and SCSS-based style helpers for our PIE Web Component library.",
|
|
5
5
|
"author": "JustEatTakeaway - Design System Web Team",
|
|
6
6
|
"files": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward './helpers';
|
package/scss/index.scss
CHANGED