react-image-gallery 1.3.0 → 2.0.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/LICENSE +1 -1
- package/README.md +80 -18
- package/build/image-gallery.cjs +1 -0
- package/build/image-gallery.css +1 -0
- package/build/image-gallery.es.js +1 -0
- package/build/types/types.d.ts +406 -0
- package/package.json +81 -47
- package/styles/image-gallery.css +683 -0
- package/.eslintrc.json +0 -47
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -39
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/eslint.yml +0 -56
- package/babel.config.js +0 -3
- package/build/image-gallery.js +0 -1
- package/jest.config.js +0 -16
- package/src/components/ImageGallery.jsx +0 -1727
- package/src/components/ImageGallery.test.jsx +0 -22
- package/src/components/Item.jsx +0 -75
- package/src/components/SVG.jsx +0 -59
- package/src/components/SwipeWrapper.jsx +0 -37
- package/src/components/controls/Fullscreen.jsx +0 -25
- package/src/components/controls/LeftNav.jsx +0 -26
- package/src/components/controls/PlayPause.jsx +0 -25
- package/src/components/controls/RightNav.jsx +0 -26
- package/styles/css/image-gallery.css +0 -1
- package/styles/scss/image-gallery.scss +0 -453
- package/webpack.build.js +0 -171
- package/webpack.config.js +0 -52
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
$ig-small-screen: 768px !default;
|
|
2
|
-
$ig-xsmall-screen: 480px !default;
|
|
3
|
-
$ig-white: #fff !default;
|
|
4
|
-
$ig-black: #000 !default;
|
|
5
|
-
$ig-blue: #337ab7 !default;
|
|
6
|
-
$ig-background-black: rgba(0, 0, 0, .4) !default;
|
|
7
|
-
$ig-transparent: rgba(0, 0, 0, 0) !default;
|
|
8
|
-
$ig-shadow: 0 2px 2px lighten($ig-black, 10%);
|
|
9
|
-
|
|
10
|
-
@mixin vendor-prefix($name, $value) {
|
|
11
|
-
@each $vendor in ('-webkit-', '-moz-', '-ms-', '-o-', '') {
|
|
12
|
-
#{$vendor}#{$name}: #{$value};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// SVG ICON STYLES
|
|
17
|
-
.image-gallery-icon {
|
|
18
|
-
color: $ig-white;
|
|
19
|
-
transition: all .3s ease-out;
|
|
20
|
-
appearance: none;
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
border: 0;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
outline: none;
|
|
25
|
-
position: absolute;
|
|
26
|
-
z-index: 4;
|
|
27
|
-
filter: drop-shadow($ig-shadow);
|
|
28
|
-
|
|
29
|
-
@media (hover: hover) and (pointer: fine) {
|
|
30
|
-
&:hover {
|
|
31
|
-
color: $ig-blue;
|
|
32
|
-
.image-gallery-svg {
|
|
33
|
-
transform: scale(1.1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&:focus {
|
|
39
|
-
// a11y support
|
|
40
|
-
outline: 2px solid $ig-blue;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.image-gallery-using-mouse {
|
|
45
|
-
.image-gallery-icon {
|
|
46
|
-
&:focus {
|
|
47
|
-
outline: none;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.image-gallery-fullscreen-button,
|
|
53
|
-
.image-gallery-play-button {
|
|
54
|
-
bottom: 0;
|
|
55
|
-
padding: 20px;
|
|
56
|
-
|
|
57
|
-
.image-gallery-svg {
|
|
58
|
-
height: 28px;
|
|
59
|
-
width: 28px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@media (max-width: $ig-small-screen) {
|
|
63
|
-
padding: 15px;
|
|
64
|
-
|
|
65
|
-
.image-gallery-svg {
|
|
66
|
-
height: 24px;
|
|
67
|
-
width: 24px;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@media (max-width: $ig-xsmall-screen) {
|
|
72
|
-
padding: 10px;
|
|
73
|
-
|
|
74
|
-
.image-gallery-svg {
|
|
75
|
-
height: 16px;
|
|
76
|
-
width: 16px;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.image-gallery-fullscreen-button {
|
|
82
|
-
right: 0;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.image-gallery-play-button {
|
|
86
|
-
left: 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.image-gallery-left-nav,
|
|
90
|
-
.image-gallery-right-nav {
|
|
91
|
-
padding: 50px 10px;
|
|
92
|
-
top: 50%;
|
|
93
|
-
transform: translateY(-50%);
|
|
94
|
-
|
|
95
|
-
.image-gallery-svg {
|
|
96
|
-
height: 120px;
|
|
97
|
-
width: 60px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@media (max-width: $ig-small-screen) {
|
|
101
|
-
.image-gallery-svg {
|
|
102
|
-
height: 72px;
|
|
103
|
-
width: 36px;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@media (max-width: $ig-xsmall-screen) {
|
|
108
|
-
.image-gallery-svg {
|
|
109
|
-
height: 48px;
|
|
110
|
-
width: 24px;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&[disabled] {
|
|
115
|
-
cursor: disabled;
|
|
116
|
-
opacity: .6;
|
|
117
|
-
pointer-events: none;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.image-gallery-left-nav {
|
|
122
|
-
left: 0;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.image-gallery-right-nav {
|
|
126
|
-
right: 0;
|
|
127
|
-
}
|
|
128
|
-
// End of Icon styles
|
|
129
|
-
|
|
130
|
-
.image-gallery {
|
|
131
|
-
@include vendor-prefix('user-select', none);
|
|
132
|
-
-webkit-tap-highlight-color: $ig-transparent;
|
|
133
|
-
position: relative;
|
|
134
|
-
|
|
135
|
-
&.fullscreen-modal {
|
|
136
|
-
background: $ig-black;
|
|
137
|
-
bottom: 0;
|
|
138
|
-
height: 100%;
|
|
139
|
-
left: 0;
|
|
140
|
-
position: fixed;
|
|
141
|
-
right: 0;
|
|
142
|
-
top: 0;
|
|
143
|
-
width: 100%;
|
|
144
|
-
z-index: 5;
|
|
145
|
-
|
|
146
|
-
.image-gallery-content {
|
|
147
|
-
top: 50%;
|
|
148
|
-
transform: translateY(-50%);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.image-gallery-content {
|
|
154
|
-
position: relative;
|
|
155
|
-
line-height: 0;
|
|
156
|
-
top: 0;
|
|
157
|
-
|
|
158
|
-
&.fullscreen {
|
|
159
|
-
background: $ig-black;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.image-gallery-slide .image-gallery-image {
|
|
163
|
-
max-height: calc(100vh - 80px); // 80 px for the thumbnail space
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&.image-gallery-thumbnails-left,
|
|
167
|
-
&.image-gallery-thumbnails-right {
|
|
168
|
-
.image-gallery-slide .image-gallery-image {
|
|
169
|
-
max-height: 100vh;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.image-gallery-slide-wrapper {
|
|
175
|
-
position: relative;
|
|
176
|
-
|
|
177
|
-
&.image-gallery-thumbnails-left,
|
|
178
|
-
&.image-gallery-thumbnails-right {
|
|
179
|
-
display: inline-block;
|
|
180
|
-
width: calc(100% - 110px); // 100px + 10px for margin
|
|
181
|
-
|
|
182
|
-
@media (max-width: $ig-small-screen) {
|
|
183
|
-
width: calc(100% - 87px); // 81px + 6px for margin
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
&.image-gallery-rtl {
|
|
187
|
-
direction: rtl;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.image-gallery-slides {
|
|
192
|
-
line-height: 0;
|
|
193
|
-
overflow: hidden;
|
|
194
|
-
position: relative;
|
|
195
|
-
white-space: nowrap;
|
|
196
|
-
text-align: center;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.image-gallery-slide {
|
|
200
|
-
left: 0;
|
|
201
|
-
position: absolute;
|
|
202
|
-
top: 0;
|
|
203
|
-
width: 100%;
|
|
204
|
-
|
|
205
|
-
&.image-gallery-center {
|
|
206
|
-
position: relative;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.image-gallery-image {
|
|
210
|
-
width: 100%;
|
|
211
|
-
object-fit: contain;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.image-gallery-description {
|
|
215
|
-
background: $ig-background-black;
|
|
216
|
-
bottom: 70px;
|
|
217
|
-
color: $ig-white;
|
|
218
|
-
left: 0;
|
|
219
|
-
line-height: 1;
|
|
220
|
-
padding: 10px 20px;
|
|
221
|
-
position: absolute;
|
|
222
|
-
white-space: normal;
|
|
223
|
-
|
|
224
|
-
@media (max-width: $ig-small-screen) {
|
|
225
|
-
bottom: 45px;
|
|
226
|
-
font-size: .8em;
|
|
227
|
-
padding: 8px 15px;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.image-gallery-bullets {
|
|
234
|
-
bottom: 20px;
|
|
235
|
-
left: 0;
|
|
236
|
-
margin: 0 auto;
|
|
237
|
-
position: absolute;
|
|
238
|
-
right: 0;
|
|
239
|
-
width: 80%;
|
|
240
|
-
z-index: 4;
|
|
241
|
-
|
|
242
|
-
.image-gallery-bullets-container {
|
|
243
|
-
margin: 0;
|
|
244
|
-
padding: 0;
|
|
245
|
-
text-align: center;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.image-gallery-bullet {
|
|
249
|
-
appearance: none;
|
|
250
|
-
background-color: transparent;
|
|
251
|
-
border: 1px solid $ig-white;
|
|
252
|
-
border-radius: 50%;
|
|
253
|
-
box-shadow: $ig-shadow;
|
|
254
|
-
cursor: pointer;
|
|
255
|
-
display: inline-block;
|
|
256
|
-
margin: 0 5px;
|
|
257
|
-
outline: none;
|
|
258
|
-
padding: 5px;
|
|
259
|
-
transition: all .2s ease-out;
|
|
260
|
-
|
|
261
|
-
@media (max-width: $ig-small-screen) {
|
|
262
|
-
margin: 0 3px;
|
|
263
|
-
padding: 3px;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
@media (max-width: $ig-xsmall-screen) {
|
|
267
|
-
padding: 2.7px;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
&:focus {
|
|
271
|
-
transform: scale(1.2);
|
|
272
|
-
background: $ig-blue;
|
|
273
|
-
border: 1px solid $ig-blue;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
&.active {
|
|
277
|
-
transform: scale(1.2);
|
|
278
|
-
border: 1px solid $ig-white;
|
|
279
|
-
background: $ig-white;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
@media (hover: hover) and (pointer: fine) {
|
|
283
|
-
&:hover {
|
|
284
|
-
background: $ig-blue;
|
|
285
|
-
border: 1px solid $ig-blue;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
&.active:hover {
|
|
289
|
-
background: $ig-blue;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.image-gallery-thumbnails-wrapper {
|
|
296
|
-
position: relative;
|
|
297
|
-
|
|
298
|
-
&.thumbnails-swipe-horizontal {
|
|
299
|
-
touch-action: pan-y;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
&.thumbnails-swipe-vertical {
|
|
303
|
-
touch-action: pan-x;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
&.thumbnails-wrapper-rtl {
|
|
307
|
-
direction: rtl;
|
|
308
|
-
}
|
|
309
|
-
&.image-gallery-thumbnails-left,
|
|
310
|
-
&.image-gallery-thumbnails-right {
|
|
311
|
-
display: inline-block;
|
|
312
|
-
vertical-align: top;
|
|
313
|
-
width: 100px;
|
|
314
|
-
|
|
315
|
-
@media (max-width: $ig-small-screen) {
|
|
316
|
-
width: 81px; // 75px + 6px for border
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.image-gallery-thumbnails {
|
|
320
|
-
height: 100%;
|
|
321
|
-
width: 100%;
|
|
322
|
-
left: 0;
|
|
323
|
-
padding: 0;
|
|
324
|
-
position: absolute;
|
|
325
|
-
top: 0;
|
|
326
|
-
|
|
327
|
-
.image-gallery-thumbnail {
|
|
328
|
-
display: block;
|
|
329
|
-
margin-right: 0;
|
|
330
|
-
padding: 0;
|
|
331
|
-
|
|
332
|
-
+ .image-gallery-thumbnail {
|
|
333
|
-
margin-left: 0;
|
|
334
|
-
margin-top: 2px;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
&.image-gallery-thumbnails-left,
|
|
343
|
-
&.image-gallery-thumbnails-right {
|
|
344
|
-
margin: 0 5px;
|
|
345
|
-
|
|
346
|
-
@media (max-width: $ig-small-screen) {
|
|
347
|
-
margin: 0 3px;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.image-gallery-thumbnails {
|
|
353
|
-
overflow: hidden;
|
|
354
|
-
padding: 5px 0;
|
|
355
|
-
|
|
356
|
-
@media (max-width: $ig-small-screen) {
|
|
357
|
-
padding: 3px 0;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.image-gallery-thumbnails-container {
|
|
361
|
-
cursor: pointer;
|
|
362
|
-
text-align: center;
|
|
363
|
-
white-space: nowrap;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.image-gallery-thumbnail {
|
|
369
|
-
display: inline-block;
|
|
370
|
-
border: 4px solid transparent;
|
|
371
|
-
transition: border .3s ease-out;
|
|
372
|
-
width: 100px;
|
|
373
|
-
background: transparent;
|
|
374
|
-
padding: 0;
|
|
375
|
-
|
|
376
|
-
@media (max-width: $ig-small-screen) {
|
|
377
|
-
border: 3px solid transparent;
|
|
378
|
-
width: 81px;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
+ .image-gallery-thumbnail {
|
|
382
|
-
margin-left: 2px;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.image-gallery-thumbnail-inner {
|
|
386
|
-
display: block;
|
|
387
|
-
position: relative;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.image-gallery-thumbnail-image {
|
|
391
|
-
vertical-align: middle;
|
|
392
|
-
width: 100%;
|
|
393
|
-
line-height: 0;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
&.active,
|
|
397
|
-
&:focus {
|
|
398
|
-
outline: none;
|
|
399
|
-
border: 4px solid $ig-blue;
|
|
400
|
-
|
|
401
|
-
@media (max-width: $ig-small-screen) {
|
|
402
|
-
border: 3px solid $ig-blue;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
@media (hover: hover) and (pointer: fine) {
|
|
407
|
-
&:hover {
|
|
408
|
-
outline: none;
|
|
409
|
-
border: 4px solid $ig-blue;
|
|
410
|
-
|
|
411
|
-
@media (max-width: $ig-small-screen) {
|
|
412
|
-
border: 3px solid $ig-blue;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.image-gallery-thumbnail-label {
|
|
420
|
-
box-sizing: border-box;
|
|
421
|
-
color: white;
|
|
422
|
-
font-size: 1em;
|
|
423
|
-
left: 0;
|
|
424
|
-
line-height: 1em;
|
|
425
|
-
padding: 5%;
|
|
426
|
-
position: absolute;
|
|
427
|
-
top: 50%;
|
|
428
|
-
text-shadow: $ig-shadow;
|
|
429
|
-
transform: translateY(-50%);
|
|
430
|
-
white-space: normal;
|
|
431
|
-
width: 100%;
|
|
432
|
-
|
|
433
|
-
@media(max-width: $ig-small-screen) {
|
|
434
|
-
font-size: .8em;
|
|
435
|
-
line-height: .8em;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
.image-gallery-index {
|
|
440
|
-
background: $ig-background-black;
|
|
441
|
-
color: $ig-white;
|
|
442
|
-
line-height: 1;
|
|
443
|
-
padding: 10px 20px;
|
|
444
|
-
position: absolute;
|
|
445
|
-
right: 0;
|
|
446
|
-
top: 0;
|
|
447
|
-
z-index: 4;
|
|
448
|
-
|
|
449
|
-
@media(max-width: $ig-small-screen) {
|
|
450
|
-
font-size: .8em;
|
|
451
|
-
padding: 5px 10px;
|
|
452
|
-
}
|
|
453
|
-
}
|
package/webpack.build.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
3
|
-
const RemovePlugin = require("remove-files-webpack-plugin");
|
|
4
|
-
|
|
5
|
-
const config = {
|
|
6
|
-
mode: "production",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const jsOutput = Object.assign({}, config, {
|
|
10
|
-
entry: ["./src/components/ImageGallery.jsx"],
|
|
11
|
-
output: {
|
|
12
|
-
path: path.resolve(__dirname, "build"),
|
|
13
|
-
filename: "image-gallery.js",
|
|
14
|
-
library: "ImageGallery",
|
|
15
|
-
globalObject: "this",
|
|
16
|
-
libraryTarget: "umd",
|
|
17
|
-
},
|
|
18
|
-
resolve: {
|
|
19
|
-
alias: {
|
|
20
|
-
src: path.resolve(__dirname, "src/"),
|
|
21
|
-
},
|
|
22
|
-
extensions: [".js", ".jsx"],
|
|
23
|
-
},
|
|
24
|
-
module: {
|
|
25
|
-
rules: [
|
|
26
|
-
{
|
|
27
|
-
test: /\.(js|jsx)$/,
|
|
28
|
-
exclude: /node_modules/,
|
|
29
|
-
loader: "babel-loader",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
externals: {
|
|
34
|
-
// Don't bundle react or react-dom
|
|
35
|
-
react: {
|
|
36
|
-
commonjs: "react",
|
|
37
|
-
commonjs2: "react",
|
|
38
|
-
amd: "react",
|
|
39
|
-
root: "React",
|
|
40
|
-
},
|
|
41
|
-
"react-dom": {
|
|
42
|
-
commonjs: "react-dom",
|
|
43
|
-
commonjs2: "react-dom",
|
|
44
|
-
amd: "react-dom",
|
|
45
|
-
root: "ReactDOM",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const cssOutput = Object.assign({}, config, {
|
|
51
|
-
entry: "./styles/scss/image-gallery.scss",
|
|
52
|
-
output: {
|
|
53
|
-
path: path.resolve(__dirname, "styles/css"),
|
|
54
|
-
},
|
|
55
|
-
module: {
|
|
56
|
-
rules: [
|
|
57
|
-
{
|
|
58
|
-
test: /\.(css|scss)$/i,
|
|
59
|
-
use: [
|
|
60
|
-
MiniCssExtractPlugin.loader,
|
|
61
|
-
// Translates CSS into CommonJS
|
|
62
|
-
"css-loader",
|
|
63
|
-
// Compiles Sass to CSS
|
|
64
|
-
"sass-loader",
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
plugins: [
|
|
70
|
-
new MiniCssExtractPlugin({
|
|
71
|
-
filename: "image-gallery.css",
|
|
72
|
-
}),
|
|
73
|
-
new RemovePlugin({
|
|
74
|
-
/**
|
|
75
|
-
* After compilation permanently remove empty JS files created from CSS entries.
|
|
76
|
-
*/
|
|
77
|
-
after: {
|
|
78
|
-
test: [
|
|
79
|
-
{
|
|
80
|
-
folder: "styles/css",
|
|
81
|
-
method: (absoluteItemPath) => {
|
|
82
|
-
return new RegExp(/\.js$/, "m").test(absoluteItemPath);
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
},
|
|
87
|
-
}),
|
|
88
|
-
],
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const jsDemoOutput = Object.assign({}, config, {
|
|
92
|
-
entry: ["./example/App.jsx"],
|
|
93
|
-
output: {
|
|
94
|
-
path: path.resolve(__dirname, "demo"),
|
|
95
|
-
filename: "demo.mini.js",
|
|
96
|
-
},
|
|
97
|
-
resolve: {
|
|
98
|
-
alias: {
|
|
99
|
-
src: path.resolve(__dirname, "src/"),
|
|
100
|
-
},
|
|
101
|
-
extensions: [".js", ".jsx"],
|
|
102
|
-
},
|
|
103
|
-
module: {
|
|
104
|
-
rules: [
|
|
105
|
-
{
|
|
106
|
-
test: /\.(js|jsx)$/,
|
|
107
|
-
loader: "babel-loader",
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
plugins: [
|
|
112
|
-
new RemovePlugin({
|
|
113
|
-
/**
|
|
114
|
-
* After compilation permanently remove unused LICENSE.txt file
|
|
115
|
-
*/
|
|
116
|
-
after: {
|
|
117
|
-
test: [
|
|
118
|
-
{
|
|
119
|
-
folder: "demo",
|
|
120
|
-
method: (absoluteItemPath) => {
|
|
121
|
-
return new RegExp(/\.txt$/).test(absoluteItemPath);
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
}),
|
|
127
|
-
],
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const cssDemoOutput = Object.assign({}, config, {
|
|
131
|
-
entry: ["./styles/scss/image-gallery.scss", "./example/App.css"],
|
|
132
|
-
output: {
|
|
133
|
-
path: path.resolve(__dirname, "demo"),
|
|
134
|
-
},
|
|
135
|
-
module: {
|
|
136
|
-
rules: [
|
|
137
|
-
{
|
|
138
|
-
test: /\.(css|scss)$/i,
|
|
139
|
-
use: [
|
|
140
|
-
MiniCssExtractPlugin.loader,
|
|
141
|
-
// Translates CSS into CommonJS
|
|
142
|
-
"css-loader",
|
|
143
|
-
// Compiles Sass to CSS
|
|
144
|
-
"sass-loader",
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
plugins: [
|
|
150
|
-
new MiniCssExtractPlugin({
|
|
151
|
-
filename: "demo.mini.css",
|
|
152
|
-
}),
|
|
153
|
-
new RemovePlugin({
|
|
154
|
-
/**
|
|
155
|
-
* After compilation permanently remove empty JS files created from CSS entries.
|
|
156
|
-
*/
|
|
157
|
-
after: {
|
|
158
|
-
test: [
|
|
159
|
-
{
|
|
160
|
-
folder: "demo",
|
|
161
|
-
method: (absoluteItemPath) => {
|
|
162
|
-
return new RegExp(/\.js$/).test(absoluteItemPath);
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
},
|
|
167
|
-
}),
|
|
168
|
-
],
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
module.exports = [jsOutput, cssOutput, jsDemoOutput, cssDemoOutput];
|
package/webpack.config.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
entry: [
|
|
6
|
-
"./example/App.jsx",
|
|
7
|
-
"./example/App.css",
|
|
8
|
-
"./styles/scss/image-gallery.scss",
|
|
9
|
-
],
|
|
10
|
-
output: {
|
|
11
|
-
path: path.resolve(__dirname, "example"),
|
|
12
|
-
filename: "example.js",
|
|
13
|
-
publicPath: "/dist/",
|
|
14
|
-
},
|
|
15
|
-
resolve: {
|
|
16
|
-
extensions: [".js", ".jsx"],
|
|
17
|
-
alias: {
|
|
18
|
-
src: path.resolve(__dirname, "src/"),
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
module: {
|
|
22
|
-
rules: [
|
|
23
|
-
{
|
|
24
|
-
test: /\.(js|jsx)$/,
|
|
25
|
-
loader: "babel-loader",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
test: /\.(css|scss)$/i,
|
|
29
|
-
use: [
|
|
30
|
-
// Creates `style` nodes from JS strings
|
|
31
|
-
"style-loader",
|
|
32
|
-
// Translates CSS into CommonJS
|
|
33
|
-
"css-loader",
|
|
34
|
-
// Compiles Sass to CSS
|
|
35
|
-
"sass-loader",
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
plugins: [
|
|
41
|
-
new MiniCssExtractPlugin({
|
|
42
|
-
filename: "image-gallery.css",
|
|
43
|
-
}),
|
|
44
|
-
],
|
|
45
|
-
devServer: {
|
|
46
|
-
host: "0.0.0.0",
|
|
47
|
-
port: 8001,
|
|
48
|
-
historyApiFallback: {
|
|
49
|
-
rewrites: [{ from: /\//, to: "/example/index.html" }],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|