Skip to content

Commit

Permalink
Use stylis from npm (it seems to create a smaller bundle with uglify …
Browse files Browse the repository at this point in the history
…+ rollup than with gcc + uglify + rollup) and add test for multiline declaration

Closes #470
  • Loading branch information
emmatown committed Nov 28, 2017
1 parent 580994e commit ed185da
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
1 change: 1 addition & 0 deletions packages/babel-plugin-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"emotion-utils": "^8.0.11",
"find-root": "^1.1.0",
"source-map": "^0.5.7",
"stylis": "^3.4.5",
"touch": "^1.0.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/babel-plugin-emotion/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import type {
StringLiteral,
Babel
} from 'babel-flow-types'
import { hashString, Stylis, memoize } from 'emotion-utils'
import { hashString, memoize } from 'emotion-utils'
import Stylis from 'stylis'
import { addSourceMaps } from './source-map'

import cssProps from './css-prop'
Expand Down
4 changes: 2 additions & 2 deletions packages/create-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"dependencies": {
"emotion-utils": "^8.0.11",
"stylis": "^3.3.2",
"stylis-rule-sheet": "^0.0.5"
"stylis": "^3.4.5",
"stylis-rule-sheet": "^0.0.7"
},
"devDependencies": {
"@types/react": "16.0.16",
Expand Down
3 changes: 2 additions & 1 deletion packages/create-emotion/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import { hashString, Stylis, STYLES_KEY, TARGET_KEY } from 'emotion-utils'
import { hashString, STYLES_KEY, TARGET_KEY } from 'emotion-utils'
import Stylis from 'stylis'
import stylisRuleSheet from 'stylis-rule-sheet'
import {
processStyleName,
Expand Down
1 change: 0 additions & 1 deletion packages/emotion-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ export const unitless = {
}

export { hashString } from './hash'
export { default as Stylis } from './stylis'
23 changes: 0 additions & 23 deletions packages/emotion-utils/src/stylis.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/emotion/test/__snapshots__/css.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@ exports[`css media query specificity 2`] = `
/>
`;

exports[`css multiline declaration 1`] = `
.glamor-0 {
display: grid;
grid: 'AppBar' auto 'Main' 1fr / 1fr / 1fr 1fr / 1fr1fr / 1fr1fr / 1fr1fr / 1fr1fr / 1fr auto 'Main' 1fr / 1fr / 1fr 1fr / 1fr1fr / 1fr1fr / 1fr1fr / 1fr1fr / 1fr;
}
<div
className="glamor-0"
/>
`;

exports[`css nested 1`] = `
.glamor-0 {
color: yellow;
Expand Down
10 changes: 10 additions & 0 deletions packages/emotion/test/css.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,14 @@ describe('css', () => {
expect(tree).toMatchSnapshot()
expect(sheet).toMatchSnapshot()
})
test('multiline declaration', () => {
const cls1 = css`
display: grid;
grid: 'AppBar' auto 'Main' 1fr / 1fr / 1fr 1fr / 1fr1fr / 1fr1fr / 1fr1fr /
1fr1fr / 1fr auto 'Main' 1fr / 1fr / 1fr 1fr / 1fr1fr / 1fr1fr / 1fr1fr /
1fr1fr / 1fr;
`
const tree = renderer.create(<div className={cls1} />).toJSON()
expect(tree).toMatchSnapshot()
})
})
2 changes: 1 addition & 1 deletion packages/emotion/test/insertion.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import { Stylis } from 'emotion-utils'
import Stylis from 'stylis'
import stylisRuleSheet from 'stylis-rule-sheet'

const specs = [
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9130,13 +9130,13 @@ styled-components@^2.2.1:
stylis "^3.2.1"
supports-color "^3.2.3"

stylis-rule-sheet@^0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.5.tgz#ebae935cc1f6fb31b9b62dba47f2ea8b833dad9f"
stylis-rule-sheet@^0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.7.tgz#5c51dc879141a61821c2094ba91d2cbcf2469c6c"

stylis@^3.2.1, stylis@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.3.2.tgz#95ef285836e98243f8b8f64a9a72706ea6c893ea"
stylis@^3.2.1, stylis@^3.4.5:
version "3.4.5"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.4.5.tgz#d7b9595fc18e7b9c8775eca8270a9a1d3e59806e"

supports-color@^2.0.0:
version "2.0.0"
Expand Down

0 comments on commit ed185da

Please sign in to comment.