You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 5, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+64-29Lines changed: 64 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ If you wish to contribute to PatternFly, please follow the instructions under "C
20
20
21
21
PatternFly can be installed and managed through [NPM](https://www.npmjs.com/). To do so, either add `patternfly` as a dependency in your `package.json` or run the following:
22
22
23
-
```
23
+
```sh
24
24
npm install patternfly --save
25
25
```
26
26
@@ -30,15 +30,15 @@ PatternFly stays up to date with the Node LTS [Release Schedule](https://github.
30
30
31
31
PatternFly can be installed and managed through [Bower](http://bower.io/). To do so, either add `patternfly` as a dependency in your `bower.json` or run the following:
32
32
33
-
```
33
+
```sh
34
34
bower install patternfly --save
35
35
```
36
36
37
37
#### Using Wiredep?
38
38
39
39
Are you using [Wiredep](https://github.com/taptapship/wiredep)? PatternFly's CSS includes the CSS of its dependencies. As a result, you'll want to add the following to your [Wiredep configuration](https://github.com/taptapship/wiredep#configuration) so you don't end up with duplicate CSS.
Sass is included in the `dist/sass` directory. Just add `node_modules` to your build tool's Sass include paths then `@import 'patternfly/dist/sass/patternfly';` in your Sass to get started!
63
63
64
+
#### Using Webpack?
65
+
There are two touch points for integrating patternfly sass: one in your webpack config, and another in your sass. Below is an example module rule for loading patternfly .scss files using webpack.
With webpack configured, just set the asset-path related variables and you're off!
91
+
92
+
```scss
93
+
$img-path: '~patternfly/dist/img/';
94
+
$font-path: '~patternfly/dist/fonts/';
95
+
$icon-font-path: '~patternfly/dist/fonts/';
96
+
@import'~patternfly/dist/sass/patternfly';
97
+
```
98
+
64
99
Please note that the [patternfly-sass](https://github.com/patternfly/patternfly-sass) is no longer supported and will not include any features or fixes introduced after Patternfly 3.23.2. However, the [patternfly-sass](https://rubygems.org/gems/patternfly-sass) Rubygem is maintained further and built from this repository.
65
100
66
101
### AngularJS
@@ -93,13 +128,13 @@ The development includes the use of a number of helpful tasks. In order to setup
93
128
94
129
To do this clone, and change directories into PatternFly:
95
130
96
-
```
131
+
```sh
97
132
cd [PathToYourRepository]
98
133
```
99
134
100
135
then
101
136
102
-
```
137
+
```sh
103
138
npm install
104
139
```
105
140
@@ -115,13 +150,13 @@ Additionally you may need to install the grunt command line utility. To do this
115
150
116
151
Test pages are optionally generated using [Jekyll](http://jekyllrb.com/). To use jekyll to build the test pages, ensure Ruby is installed and available then run:
117
152
118
-
```
153
+
```sh
119
154
npm run jekyll
120
155
```
121
156
122
157
or
123
158
124
-
```
159
+
```sh
125
160
gem install bundle
126
161
bundle install
127
162
```
@@ -135,7 +170,7 @@ Next, set the environment variable PF_PAGE_BUILDER=jekyll. eg.:
135
170
136
171
Anytime you pull a new version of PatternFly, make sure you also run
137
172
138
-
```
173
+
```sh
139
174
npm update
140
175
```
141
176
@@ -145,13 +180,13 @@ so you get the latest version of the dependencies specified in package.json.
145
180
146
181
A local development server can be quickly fired up by using the Gruntjs serve task:
147
182
148
-
```
183
+
```sh
149
184
npm start
150
185
```
151
186
152
187
or
153
188
154
-
```
189
+
```sh
155
190
grunt serve # will build first by default
156
191
grunt serve --skipRebuild # flag would allow you to skip the rebuild to save some time
157
192
```
@@ -168,7 +203,7 @@ PatternFly uses the [semantic-release tool](https://github.com/semantic-release/
168
203
169
204
We have configured the [commitizen tool](https://github.com/commitizen/cz-cli) to assist you in formatting your commit messages corrctly. To use this tool run the following command instead of `git commit`:
170
205
171
-
```
206
+
```sh
172
207
npm run commit
173
208
```
174
209
@@ -212,13 +247,13 @@ The tool will prompt you with several questions that it will use to correctly fo
212
247
213
248
In development, styling is written and managed through multiple Less files. In order to generate a CSS file of all styling, run the build Gruntjs task:
214
249
215
-
```
250
+
```sh
216
251
npm run build
217
252
```
218
253
219
254
or
220
255
221
-
```
256
+
```sh
222
257
grunt build
223
258
```
224
259
@@ -227,14 +262,14 @@ This task will compile and minify the Less files into CSS files located at `dist
227
262
### Less to Sass Conversion
228
263
Any time style changes are introduced, the Sass code will need to be updated to reflect those changes. The conversion is accomplished as part of the build, but in order to test the CSS you will need to build it from Sass:
229
264
230
-
```
265
+
```sh
231
266
npm start -- --sass
232
267
```
233
268
*Note the extra ` -- ` between `npm start` and the `--sass` flag. This syntax passes the flag on to the underlying grunt process instead of the npm command itself.*
234
269
235
270
or
236
271
237
-
```
272
+
```sh
238
273
grunt build --sass
239
274
```
240
275
@@ -249,7 +284,7 @@ Sass and Less do not have perfect feature parity, which can sometimes throw a wr
249
284
#### Non-parametric Mixins
250
285
Sass does not support non-parametric mixins in the same way that Less does. Mixins must be explictly declared in Sass, whereas any class definition in Less can be used as a non-parametric mixin. Sass does not have a feature that perfectly parallels this behavior, so we have to use the closest thing which is the `@extend` statement. However, an edge case exists where `@extend` statements are not allowed within media queries in Sass. This creates a scenario where uncompilable Sass code can be generated from perfectly acceptable Less. For example:
251
286
**Less:**
252
-
```
287
+
```less
253
288
.applauncher-pf {
254
289
.applauncher-pf-title {
255
290
.sr-only();
@@ -262,7 +297,7 @@ Sass does not support non-parametric mixins in the same way that Less does. Mixi
262
297
```
263
298
264
299
**Converts to Sass:**
265
-
```
300
+
```scss
266
301
.applauncher-pf {
267
302
.applauncher-pf-title {
268
303
@extend.sr-only;
@@ -277,7 +312,7 @@ Sass does not support non-parametric mixins in the same way that Less does. Mixi
277
312
This breaks for two reasons. We cannot use the `@extend` statement directly inside a media query, and even if we are able to work around that by making applauncher-pf into a mixin and using the `@include` directive, `.applauncher-pf .applauncher-pf-title` uses the `@extend` directive, which would still fall within the media query via the mixin invocation. To fix this, the Less would need to be adjusted like this:
278
313
279
314
**Less**
280
-
```
315
+
```less
281
316
// Explicitly define a non-parametric sr-only mixin.
282
317
.sr-only() {
283
318
// sr-only rules;
@@ -304,7 +339,7 @@ This breaks for two reasons. We cannot use the `@extend` statement directly insi
304
339
```
305
340
306
341
**Converts to Sass:**
307
-
```
342
+
```scss
308
343
@mixinsr-only() {
309
344
// sr-only rules
310
345
}
@@ -327,42 +362,42 @@ This breaks for two reasons. We cannot use the `@extend` statement directly insi
327
362
#### Tilde-Escaped Strings
328
363
Strings that are escaped using the tilde in Less get converted to the Sass `unquote()` function. This causes Sass compilation issues when using escaped strings inside native CSS functions like `calc()`. Here is what happens:
329
364
Less:
330
-
```
365
+
```less
331
366
height: calc(~"100vh - 20px");
332
367
```
333
368
Converts to Sass:
334
-
```
369
+
```scss
335
370
height: calc(unqoute("100vh - 20px")):
336
371
```
337
372
Which compiles directly to CSS and does not work as expected:
338
-
```
373
+
```css
339
374
height: calc(unqoute("100vh - 20px")):
340
375
```
341
376
342
377
To fix this, move the tilde operator outside of the `calc()` statement:
343
378
344
379
Less:
345
-
```
380
+
```less
346
381
height: ~"calc(100vh - 20px)";
347
382
```
348
383
Converts to Sass:
349
-
```
384
+
```scss
350
385
height: unqoute("calc(100vh - 20px)");
351
386
```
352
387
Compiles to CSS:
353
-
```
388
+
```css
354
389
height: calc(100vh - 20px);
355
390
```
356
391
357
392
#### Comma Separated CSS Rules
358
393
Using complex, comma separated rules in things like box shadows or backgrounds will cause conversion problems if they are not properly escaped. These rules should be escaped, and mixins and variables should not be used inline. For example, this statement should not be used in Less:
0 commit comments