-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Usage with Preact | ||
|
||
emotion only uses `createElement` from React so we can support Preact with an alias. Import `preact-emotion` instead of `react-emotion` and use it the same way you would with React. | ||
|
||
```jsx | ||
import styled from 'preact-emotion' | ||
|
||
const SomeComponent = styled.div` | ||
display: flex; | ||
` | ||
``` |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('babel-plugin-emotion/lib/macro-styled') |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "preact-emotion", | ||
"version": "7.1.1", | ||
"description": "The Next Generation of CSS-in-JS", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.es.js", | ||
"files": [ | ||
"dist", | ||
"macro.js" | ||
], | ||
"scripts": { | ||
"build": "npm-run-all clean rollup", | ||
"clean": "rimraf dist", | ||
"rollup": "rollup -c" | ||
}, | ||
"dependencies": { | ||
"babel-plugin-emotion": "^7.1.0", | ||
"emotion": "^7.1.1", | ||
"emotion-utils": "^7.1.0" | ||
}, | ||
"devDependencies": { | ||
"npm-run-all": "^4.0.2", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.43.0", | ||
"react-emotion": "^7.1.1" | ||
}, | ||
"author": "Kye Hohenberger", | ||
"homepage": "https://github.com/tkh44/emotion#readme", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/tkh44/emotion.git" | ||
}, | ||
"keywords": [ | ||
"styles", | ||
"emotion", | ||
"react", | ||
"preact", | ||
"css", | ||
"css-in-js" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/tkh44/emotion/issues" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import babel from 'rollup-plugin-babel' | ||
import alias from 'rollup-plugin-alias' | ||
import pkg from './package.json' | ||
|
||
export default { | ||
entry: '../react-emotion/src/index.js', | ||
external: ['preact', 'emotion', 'emotion-utils'], | ||
exports: 'named', | ||
sourceMap: true, | ||
plugins: [ | ||
babel({ | ||
presets: [ | ||
['env', { loose: true, modules: false }], | ||
'stage-0', | ||
'react', | ||
'flow' | ||
], | ||
plugins: ['babel-plugin-preval'], | ||
babelrc: false | ||
}), | ||
alias({ | ||
react: 'preact' | ||
}) | ||
], | ||
targets: [ | ||
{ dest: pkg.main, format: 'cjs' }, | ||
{ dest: pkg.module, format: 'es' } | ||
] | ||
} |