Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Implement Grommet #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions kit/views/webpack.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
</head>
<body>
<div id="main"></div>
<script defer src="/vendor.js"></script>
<script defer src="/browser.js"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions kit/webpack/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import webpack from 'webpack';
// merged/extended from for further configs
import WebpackConfig from 'webpack-config';

// CopyWebpackPlugin will be used to get our external .css
import CopyWebpackPlugin from 'copy-webpack-plugin';

// HtmlWebpackPlugin will generate our HTML
import HtmlWebpackPlugin from 'html-webpack-plugin';

// HtmlWebpackIncludeAssetsPlugin will be used to prepend our external .css to our generated styles
import HtmlWebpackIncludeAssetsPlugin from 'html-webpack-include-assets-plugin';

// CSSNext is our postcss plugin of choice, that will allow us to use 'future'
// stylesheet syntax like it's available today.
import cssnext from 'postcss-cssnext';
Expand Down Expand Up @@ -58,6 +67,12 @@ export default new WebpackConfig().merge({
// actually get that stuff working in *Javascript* -- woot!
module: {
loaders: [
// Html
{
test: /\.html$/,
loader: 'html-loader'
},

// Fonts
{
test: /\.(woff|woff2|ttf|eot)$/i,
Expand Down Expand Up @@ -104,6 +119,19 @@ export default new WebpackConfig().merge({
format: ` ${chalk.magenta.bold('ReactQL')} building [:bar] ${chalk.green.bold(':percent')} (:elapsed seconds)`,
}),

new CopyWebpackPlugin([
{ from: 'node_modules/grommet/grommet.min.css', to: 'public/assets/css/'},
]),

new HtmlWebpackPlugin({
template: 'kit/views/webpack.html',
}),

new HtmlWebpackIncludeAssetsPlugin({
assets: ['public/assets/css/grommet.min.css'],
append: false,
}),

// Options that our module loaders will pull from
new webpack.LoaderOptionsPlugin({

Expand Down
11 changes: 10 additions & 1 deletion kit/webpack/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ export const css = {
},
{
ext: 's(c|a)ss',
use: ['resolve-url-loader', 'sass-loader?sourceMap'],
use: [
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
includePaths: ['node_modules'],
sourceMap: true,
},
},
],
},
{
ext: 'less',
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"eslint-plugin-react": "^6.10.3",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.11.1",
"html-loader": "^0.4.5",
"html-webpack-include-assets-plugin": "0.0.5",
"html-webpack-plugin": "^2.28.0",
"image-webpack-loader": "^3.3.0",
"node-sass": "^4.5.2",
"postcss-cssnext": "^2.10.0",
Expand All @@ -63,6 +66,7 @@
"webpack-node-externals": "^1.5.4"
},
"dependencies": {
"grommet": "^1.3.4",
"isomorphic-fetch": "^2.2.1",
"koa": "^2.2.0",
"koa-helmet": "^3.1.0",
Expand Down
13 changes: 12 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import logo from './reactql-logo.svg';

// ----------------------

// Grommet Components
import Box from 'grommet/components/Box';
import Heading from 'grommet/components/Heading';

// We'll display this <Home> component when we're on the / route
const Home = () => (
<h1>You&apos;re on the home page - click another link above</h1>
Expand Down Expand Up @@ -92,7 +96,7 @@ class GraphQLMessage extends React.PureComponent {
}),
),
}),
}
};

render() {
const { data } = this.props;
Expand All @@ -113,6 +117,13 @@ const Styles = () => (
<li className={css.example}>Styled by CSS</li>
<li className={sass.example}>Styled by SASS</li>
<li className={less.example}>Styled by LESS</li>
<Box colorIndex='ok'>
<li>
<Heading align='start' margin='none' strong='true' tag='h3'>
Styled by Grommet
</Heading>
</li>
</Box>
</ul>
);

Expand Down
2 changes: 2 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '~grommet/scss/vanilla/index';

$background: #ffc107;

.example {
Expand Down