Skip to content

Commit

Permalink
Add glam example project
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Hohenberger committed May 30, 2017
1 parent b336678 commit 2057419
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/glam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# emotion/glam example project

## Start

`npm install`

`npm start`

Go to `localhost:3000`
38 changes: 38 additions & 0 deletions examples/glam/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "emotion-glam-example-project",
"version": "1.0.0",
"description": "emotion/glam example project",
"scripts": {
"start": "webpack-dev-server --content-base build/ --port 3000"
},
"dependencies": {
"glam": "^4.0.3",
"react": "^15.5.4",
"react-dom": "^15.5.4"
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.4",
"emotion": "^0.0.6",
"html-webpack-plugin": "^2.28.0",
"standard": "^10.0.2",
"webpack": "^2.2.0",
"webpack-dev-server": "^2.4.5"
},
"author": "Kye Hohenberger",
"license": "MIT",
"eslintConfig": {
"extends": "standard",
"parser": "babel-eslint"
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"/dist/"
]
}
}
15 changes: 15 additions & 0 deletions examples/glam/src/index.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8" />
</head>

<body>
<div id="app">

</div>
<script src="main.js"></script>
</body>

</html>
3 changes: 3 additions & 0 deletions examples/glam/src/legacy.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {
color: green;
}
21 changes: 21 additions & 0 deletions examples/glam/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import './legacy.css'
import './main.js.css'
import React from 'react'
import { render } from 'react-dom'
import css, { fragment } from 'glam'

function Profile ({ name, color }) {
return (
<h1
className="old-legacy-className"
css={`
color: ${color};
font-size: 128px;
`}
>
Hello {name}
</h1>
)
}

render(<Profile name="Dave" color="#4263eb" />, document.getElementById('app'))
3 changes: 3 additions & 0 deletions examples/glam/src/main.js.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* do not edit this file */
.css-rumnts { color: var(--css-rumnts-0);
font-size: 128px; }
42 changes: 42 additions & 0 deletions examples/glam/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')

var loaders = [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['babel-preset-es2015', 'react'],
plugins: ['glam/babel', 'emotion/glam']
}
},
{
test: /\.css?$/,
loader: 'glam/loader'
}
]

module.exports = {
devtool: 'eval-source-map',
entry: path.resolve('src', 'main.js'),
output: {
path: path.resolve('build'),
filename: 'main.js',
publicPath: '/'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve('src', 'index.tpl.html'),
filename: 'index.html',
inject: false
})
],
module: {
loaders: loaders
}
}

0 comments on commit 2057419

Please sign in to comment.