Skip to content

Commit

Permalink
project setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrtsmith committed Jul 17, 2017
0 parents commit bb654e1
Show file tree
Hide file tree
Showing 17 changed files with 4,603 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
"react",
[
"env",
{
"targets": {
"browsers": ["last 2 versions", "ie 9-11"]
}
}
]
]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
npm-debug.log
*.DS_Store
node_modules
dist
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Nebula-CSS & React + ES6 + Webpack Starter Project

## Get Started
1. fork / clone this repository
2. `npm install` OR `yarn`
3. `npm start` OR `yarn start` to start the Webpack Development Server
4. `npm run build` OR `yarn build` for production build

**Note** This is a very minimal starter pack, you are encourage to add in your
own unit testing framework, if you are pulling in images or SVGs you
will require the appropriate Webpack-loaders.

As is Babel and Autoprefixer are configured to support the following environments:
```
"last 2 versions", "ie 9-11"
```
These can be re-configured in your `.babelrc` and `webpack-config.babel` files.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Neblua starter</title>
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
</html>
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "nebula-css-react-starter",
"version": "0.1.0",
"description": "A starting point for React JS Project consuming Nebula-CSS",
"main": "index.js",
"scripts": {
"build": "webpack",
"start": "webpack-dev-server --open"
},
"keywords": [
"nebula",
"CSS",
"react",
"starter",
"webpack"
],
"author": "Robert Smith",
"license": "MIT",
"dependencies": {
"nebula-css": "^2.3.1",
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.28.4",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.5.1",
"webpack-merge": "^4.1.0"
}
}
17 changes: 17 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'

const App = ({ title }) => (
<div className="o-site-wrap o-site-wrap--padding">
<h1>{title}</h1>
<div className="o-grid o-grid--matrix">
<div className="o-grid__item u-1/2@sm">
grid item 1
</div>
<div className="o-grid__item u-1/2@sm">
grid item 2
</div>
</div>
</div>
)

export default App
9 changes: 9 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import { render } from 'react-dom'

import App from './App'
import './scss/main.scss'

const appTitle = 'Welcome to your React + Nebula project'

render(<App title={appTitle} />, document.querySelector('#app'));
1 change: 1 addition & 0 deletions src/scss/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/base';
Empty file added src/scss/_components.scss
Empty file.
1 change: 1 addition & 0 deletions src/scss/_objects.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/objects';
1 change: 1 addition & 0 deletions src/scss/_resets.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/resets';
1 change: 1 addition & 0 deletions src/scss/_settings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/settings';
1 change: 1 addition & 0 deletions src/scss/_tools.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/tools';
1 change: 1 addition & 0 deletions src/scss/_utilities.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'nebula-css/utilities';
8 changes: 8 additions & 0 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import 'settings';
@import 'tools';
@import 'resets';
@import 'base';
@import 'objects';
@import 'components';
@import 'utilities';

76 changes: 76 additions & 0 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import webpack from 'webpack'
import path from 'path'
import merge from 'webpack-merge'
import autoprefixer from 'autoprefixer'

const common = {
entry: path.resolve(__dirname, './src'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{ test: /\.jsx?$/, use: 'babel-loader' },
{
test: /\.s?css$/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({ browsers: ['last 2 versions', 'ie 9-11'] })
]
}
}, {
loader: 'sass-loader',
options: {
includePaths: [
path.resolve(__dirname, './node_modules/nebula-css')
]
}
}]
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.scss']
}
}

const dev = {
devServer: {
historyApiFallback: true
},
devtool: 'source-map'
}

const prod = {
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
sourceMap: false
})
]
}

const config = (env) => {
switch (env) {
case 'build':
return merge(common, prod)
case 'start':
return merge(common, dev)
default:
return common
}
}

export default config(process.env.npm_lifecycle_event)
Loading

0 comments on commit bb654e1

Please sign in to comment.