-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate @imgix/js-core into react-imgix (#780)
* build: add @imgix/js-core as a dependency * feat: impl targetWidths in terms of ImgixClient.targetWidths() * feat: impl buildSrcSet in terms of @imgix/js-core * fix: test that issue #763 has been fixed * refactor: remove dead code * refactor: tidy up * fix: no need to include w or h if building fluid-width srcset
- Loading branch information
1 parent
0d52511
commit 690e7b6
Showing
9 changed files
with
167 additions
and
2,103 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
export const DPR_QUALITY = { | ||
q_dpr1: 75, | ||
q_dpr2: 50, | ||
q_dpr3: 35, | ||
q_dpr4: 23, | ||
q_dpr5: 20, | ||
}; | ||
|
||
export const PACKAGE_VERSION = "9.0.4"; | ||
|
||
export const DPR_QUALITY_VALUES = Object.values(DPR_QUALITY); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
function targetWidths() { | ||
const resolutions = []; | ||
let prev = 100; | ||
const INCREMENT_PERCENTAGE = 8; | ||
const MAX_SIZE = 8192; | ||
import ImgixClient from "@imgix/js-core"; | ||
|
||
const ensureEven = (n) => 2 * Math.round(n / 2); | ||
|
||
while (prev <= MAX_SIZE) { | ||
resolutions.push(ensureEven(prev)); | ||
prev *= 1 + (INCREMENT_PERCENTAGE / 100) * 2; | ||
} | ||
|
||
resolutions.push(MAX_SIZE); | ||
return resolutions; | ||
} | ||
|
||
export default targetWidths(); | ||
export default ImgixClient.targetWidths(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters