Skip to content

Commit

Permalink
feat: add ixlib url parameter to help Imgix support and analytics (#145)
Browse files Browse the repository at this point in the history
* test: add failing test for ixlib param

* feat: add ixlib param to generated urls

* doc: add doc for ixlib param

* test: update tests to check for ixlib params in more places

* chore: s/Imgix/imgix
  • Loading branch information
frederickfogerty committed Jun 27, 2018
1 parent cef398e commit 44f3d32
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 53 deletions.
20 changes: 10 additions & 10 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"presets": ["react", ["env", { "modules": false }], "stage-0"],
"plugins": ["transform-object-assign"],
"env": {
"commonjs": {
"presets": ["react", "env", "stage-0"]
},
"test": {
"presets": ["react", "env", "stage-0"]
}
}
"presets": ["react", ["env", { "modules": false }], "stage-0"],
"plugins": ["transform-object-assign", "inline-package-json"],
"env": {
"commonjs": {
"presets": ["react", "env", "stage-0"]
},
"test": {
"presets": ["react", "env", "stage-0"]
}
}
}
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=120" srcset="https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=120 1x,
https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=120&dpr=2 2x, https://assets.imgix.net/imgix-logo-web-2014.pdf?page=2&fm=png&w=120&dpr=3 3x" alt="imgix logo">

# Imgix for React
# imgix for React

[![npm](https://img.shields.io/npm/dm/react-imgix.svg)](https://www.npmjs.com/package/react-imgix)
[![npm version](https://img.shields.io/npm/v/react-imgix.svg)](https://www.npmjs.com/package/react-imgix)
Expand All @@ -10,7 +10,7 @@
[![Code Climate](https://codeclimate.com/github/imgix/react-imgix/badges/gpa.svg)](https://codeclimate.com/github/imgix/react-imgix)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

A [React](https://facebook.github.io/react/) component that renders images using the [Imgix](https://www.imgix.com/) API. It uses the smallest images possible, and does cool stuff, like [cropping to faces](https://www.imgix.com/docs/reference/size#param-crop) by default.
A [React](https://facebook.github.io/react/) component that renders images using the [imgix](https://www.imgix.com/) API. It uses the smallest images possible, and does cool stuff, like [cropping to faces](https://www.imgix.com/docs/reference/size#param-crop) by default.

- [Installation](#installation)
- [Usage](#usage)
Expand Down Expand Up @@ -46,7 +46,7 @@ Whether to wait until the component has mounted to render the image, useful for

#### auto :: array, default = ['format']

Array of values to pass to Imgix's auto param
Array of values to pass to imgix's auto param

#### type :: string, default = 'img'

Expand All @@ -62,7 +62,7 @@ Wrapper component to use when rendering a `bg`, defaults to `div`

#### entropy :: bool, default = false

Whether or not to crop using points of interest. See Imgix API for more details.
Whether or not to crop using points of interest. See imgix API for more details.

#### faces :: bool, default = true

Expand All @@ -74,7 +74,7 @@ Sets specific crop, overriding faces and entropy flags. Useful for specifying fa

#### fit :: string

See Imgix's API, defaults to `crop`
See imgix's API, defaults to `crop`

#### fluid :: bool, default = true

Expand Down Expand Up @@ -108,9 +108,13 @@ Fallback width for images, useful for SSR or static site generation

Generate `2x` and `3x` src sets when using an `<img>` tag. Defaults to `true`

#### disableLibraryParam :: bool

By default this component adds a parameter to the generated url to help imgix with analytics and support for this library. This can be disabled by setting this prop to `true`.

#### customParams :: object

Any other Imgix params to add to the image `src`
Any other imgix params to add to the image `src`

_For example_:

Expand Down
217 changes: 200 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"babel-core": "^6.25.0",
"babel-eslint": "^8.0.2",
"babel-loader": "^7.1.4",
"babel-plugin-inline-package-json": "^2.0.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
Expand All @@ -82,6 +83,7 @@
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.1.1",
"react-test-renderer": "^16.1.1",
"read-pkg-up": "^4.0.0",
"rimraf": "^2.6.2",
"sinon": "^4.1.2",
"skin-deep": "^1.1.0",
Expand Down
Loading

0 comments on commit 44f3d32

Please sign in to comment.