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 May 22, 2024. It is now read-only.
- 🌍 **Universal** - a flexible image build process that doesn't enforce any principles
31
31
- ✂️ **Cross-platform** - Tested on Windows, macOS and Linux
32
32
- 😊 **Friendly experience** - telling you what's going on, from start to finish
33
+
- ✨ **SVG Tracing** - for [really fancy placeholders][link-traced-svg]
33
34
34
35
<divalign="center">
35
36
@@ -46,7 +47,10 @@
46
47
47
48
## Why
48
49
49
-
Webpack... Angular... React... PHP... Cloudflare... So many solutions for serving images, some terrible, some paid. What if you just want to serve modern [WebP][link-webp-speed] images with [srcset][link-srcset] optimization, [lazy-loading][link-lazy-sizes] (with low-quality placeholder), fingerprint cache-busting, aggressive compression, while also exporting the original codec for [browsers that are late to the party][link-caniuse] (ahem Safari, Firefox, Edge, ...)?
50
+
A lighter web is now more important than ever, with cloud computing taking off and their [ridiculous bandwidth costs][link-bandwidth-costs]! Next to video, images are the largest payload for videos to provide, incurring significant costs if not done correctly, not to mention extra charges and wait times for the user.
51
+
52
+
Webpack... Angular... React... PHP... Cloudflare... So many solutions for serving images, some terrible, some paid. What if you just want to serve modern [WebP][link-webp-speed] images with [srcset][link-srcset] optimization, [lazy-loading][link-lazy-sizes] (with low-quality placeholder OR amazing traced-SVGs), fingerprint cache-busting, aggressive compression, while also exporting the original codec for [browsers that are late to the party][link-caniuse] (ahem Safari, Firefox, Edge, ...)?
53
+
50
54
51
55
<palign="center">
52
56
Is that really too much to ask?
@@ -58,6 +62,8 @@ That's just all that you <i>can</i> do, RIB can help you with any combination of
58
62
59
63
### What this does
60
64
65
+
*Chuck any high-quality originals in a folder, and RIB will non-destructively create a set of web-optimized responsive images for each original image in another folder. No more manual resizing, compressing, "where did I put the original?".*
66
+
61
67
In it's most basic form. with no additional configuration, RIB will scan a given directory for image files, and export them to a folder of your choosing. The export process consists of creating four different sized images from the source, converting a WebP copy of each size, optimizing them for web use before saving them using unique and predictable files names.
62
68
63
69
Finally, a [manifest](#manifest) file in [JSON][link-json] format is saved along with the images, containing information about every image's exported sizes, format, accompanying WebP file, final URL, etc...
@@ -68,9 +74,9 @@ The resulting manifest file is a few KB of data that lets you easily resolve an
68
74
69
75
It follows the [KISS principle][link-kiss]. We tend to over-complicate everything when it comes to website development when usually most things can be done really simply...
70
76
71
-
Of course, more elaborate websites require complicated design principles to scale better, but they should have a custom build pipeline anyway, such as a script that suits their needs perfectly (which, incidentally, is how this project came to be).
77
+
Of course, more elaborate websites require complicated design principles to scale better, but they should have a custom build pipeline that suits their needs perfectly (which, incidentally, is how this project came to be).
72
78
73
-
RIB makes it easy to take a set of high-quality source images and just make them work on the web. Optimized, with several different responsive breakpoints, the assurance of no duplicate files meaning no wasted space or bandwidth. See the [example](example/) to see what it does.
79
+
RIB makes it easy to take a set of high-quality source images and just make them work on the web. Optimized, with several different responsive breakpoints, the assurance of no duplicate sizes or files meaning no wasted space or bandwidth. See the [example](example/) to see what it does.
@@ -517,6 +523,31 @@ This will enable fingerprinting, adding a new property to the `original` group o
517
523
"fingerprint": "5ae7554b"# When using --short-hash
518
524
```
519
525
526
+
## SVG Placeholders
527
+
528
+
RIB supports [potrace][link-potrace] to create a beautiful SVG placeholder. It can be used like [this][link-traced-svg] as a tiny (2-6KB) placeholder until you have downloaded the full high quality image. In some ways it provides a more pleasing experience than a blurred 8x8 thumbnail.
529
+
530
+
SVGs are vector graphics that scale to any resolution, it only contains primitive shapes that represents strong edges/contrasts in the source image.
531
+
532
+
By default, RIB will create a traced image for every non-SVG export. You can customize the name of this traced image using the `traceTemplate` config option.
533
+
534
+
The `traceOptions` configuration property will pass down all options to [potrace][link-potrace], this lets you change the colour and complexity of the image.
535
+
536
+
**Example**
537
+
538
+
```javascript
539
+
rib({
540
+
traceOptions: {
541
+
color:'lightgray',
542
+
optTolerance:0.4,
543
+
turdSize:100,
544
+
turnPolicy:potrace.Potrace.TURNPOLICY_MAJORITY
545
+
}
546
+
})
547
+
```
548
+
549
+
<palign="center"><sub>You may need to import the potrace library, or used hard-coded constant values</sub></p>
550
+
520
551
## Typescript
521
552
522
553
Since v2.0.0, the entire project has been rewritten in Typescript. This not only provides more robust compilation with less chance of stupid errors but also provides strong typings for practically all function parameters and returns.
@@ -566,7 +597,9 @@ And of course, at the end of the pipeline are beautifully compressed images.
566
597
567
598
## Converting
568
599
569
-
Converting is used to change the format of the fallback image, and can be done using the `convert` option. This can be used, for example, to convert high-quality TIFF image files into JPEG and WebP images optimized for the web. It allows for slightly more compatibility and automation during the build process.
600
+
Converting is used to change the format of the image before entering the pipeline. This is done using the `convert` option.
601
+
602
+
Converting allows you to, for example, convert high-quality TIFF image files into JPEG (and the accompanying WebP image), which is far more compatible, without the need to convert the original yourself.
570
603
571
604
## Troubleshooting
572
605
@@ -578,7 +611,7 @@ If you have a bug, issue or a feature request, open a [new issue][link-issues] u
578
611
579
612
If you would like to contribute directly, see [contributing][link-contributing] to learn how to make changes and submit a Pull Request.
580
613
581
-
Responsive Image Builder uses [Travis CI](link-travis) and [semantic-release][link-semantic-release] to test the master and develop branches and publish any significant changes immediately to npm and GitHub.
614
+
Responsive Image Builder uses [Travis CI][link-travis] and [semantic-release][link-semantic-release] to test the master and develop branches and publish any significant changes immediately to npm and GitHub.
582
615
583
616
<divalign="center">
584
617
@@ -620,6 +653,7 @@ Stretch goals for the next feature release. Completed goals are removed after th
0 commit comments