Skip to content

Commit

Permalink
fix(color): Improve the library size for webpack (#204)
Browse files Browse the repository at this point in the history
* perf(general): Improve the library size for webpack users

See https://iamakulov.com/notes/polished-webpack/ for the decisions behind the change

* perf(general): Update the assets

* perf(general): Update the assets (again)

* perf(general): Update the assets (third attempt)

* perf(general): Update the assets (fourth attempt) + fix the naming of `em` and `rem` in docs

* perf(general): Fix the style errors
  • Loading branch information
iamakulov authored and bhough committed Jun 23, 2017
1 parent f127e0c commit 7343037
Show file tree
Hide file tree
Showing 20 changed files with 608 additions and 562 deletions.
341 changes: 178 additions & 163 deletions docs/assets/polished.js

Large diffs are not rendered by default.

135 changes: 68 additions & 67 deletions docs/docs/index.html

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/color/adjustHue.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ function adjustHue(degree: number, color: string): string {
})
}

export default curry(adjustHue)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedAdjustHue = /*#__PURE__*/curry(adjustHue) // eslint-disable-line spaced-comment
export default curriedAdjustHue
4 changes: 3 additions & 1 deletion src/color/darken.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ function darken(amount: number, color: string): string {
})
}

export default curry(darken)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedDarken = /*#__PURE__*/curry(darken) // eslint-disable-line spaced-comment
export default curriedDarken
4 changes: 3 additions & 1 deletion src/color/desaturate.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ function desaturate(amount: number, color: string): string {
})
}

export default curry(desaturate)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedDesaturate = /*#__PURE__*/curry(desaturate) // eslint-disable-line spaced-comment
export default curriedDesaturate
4 changes: 3 additions & 1 deletion src/color/lighten.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ function lighten(amount: number, color: string): string {
})
}

export default curry(lighten)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedLighten = /*#__PURE__*/curry(lighten) // eslint-disable-line spaced-comment
export default curriedLighten
4 changes: 3 additions & 1 deletion src/color/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ function mix(weight: number = 0.5, color: string, otherColor: string): string {
return rgba(mixedColor)
}

export default curry(mix)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedMix = /*#__PURE__*/curry(mix) // eslint-disable-line spaced-comment
export default curriedMix
4 changes: 3 additions & 1 deletion src/color/opacify.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ function opacify(amount: number, color: string) {
return rgba(colorWithAlpha)
}

export default curry(opacify)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedOpacify = /*#__PURE__*/curry(opacify) // eslint-disable-line spaced-comment
export default curriedOpacify
4 changes: 3 additions & 1 deletion src/color/saturate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ function saturate(amount: number, color: string): string {
})
}

export default curry(saturate)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedSaturate = /*#__PURE__*/curry(saturate) // eslint-disable-line spaced-comment
export default curriedSaturate
4 changes: 3 additions & 1 deletion src/color/setHue.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ function setHue(hue: number, color: string): string {
})
}

export default curry(setHue)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedSetHue = /*#__PURE__*/curry(setHue) // eslint-disable-line spaced-comment
export default curriedSetHue
4 changes: 3 additions & 1 deletion src/color/setLightness.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ function setLightness(lightness: number, color: string): string {
})
}

export default curry(setLightness)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedSetLightness = /*#__PURE__*/curry(setLightness) // eslint-disable-line spaced-comment
export default curriedSetLightness
4 changes: 3 additions & 1 deletion src/color/setSaturation.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ function setSaturation(saturation: number, color: string): string {
})
}

export default curry(setSaturation)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedSetSaturation = /*#__PURE__*/curry(setSaturation) // eslint-disable-line spaced-comment
export default curriedSetSaturation
4 changes: 3 additions & 1 deletion src/color/shade.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ function shade(percentage: number, color: string) {
return mix(percentage, color, 'rgb(0, 0, 0)')
}

export default curry(shade)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedShade = /*#__PURE__*/curry(shade) // eslint-disable-line spaced-comment
export default curriedShade
4 changes: 3 additions & 1 deletion src/color/tint.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ function tint(percentage: number, color: string) {
return mix(percentage, color, 'rgb(255, 255, 255)')
}

export default curry(tint)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedTint = /*#__PURE__*/curry(tint) // eslint-disable-line spaced-comment
export default curriedTint
4 changes: 3 additions & 1 deletion src/color/transparentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ function transparentize(amount: number, color: string) {
return rgba(colorWithAlpha)
}

export default curry(transparentize)
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const curriedTransparentize = /*#__PURE__*/curry(transparentize) // eslint-disable-line spaced-comment
export default curriedTransparentize
4 changes: 3 additions & 1 deletion src/helpers/em.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ import pixelsto from '../internalHelpers/_pxto'
* }
*/

export default pixelsto('em')
// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const em = /*#__PURE__*/pixelsto('em') // eslint-disable-line spaced-comment
export default em
5 changes: 4 additions & 1 deletion src/helpers/rem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ import pixelsto from '../internalHelpers/_pxto'
* 'height': '1rem'
* }
*/
export default pixelsto('rem')

// Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment
const rem = /*#__PURE__*/pixelsto('rem') // eslint-disable-line spaced-comment
export default rem

0 comments on commit 7343037

Please sign in to comment.