Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoGentile committed Mar 1, 2017
0 parents commit c6dcca7
Show file tree
Hide file tree
Showing 43 changed files with 1,468 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
"react",
"es2015",
"stage-3"
],
"plugins": [
"transform-runtime",
"transform-decorators-legacy",
"transform-class-properties",
"react-hot-loader/babel",
"react-html-attrs"
]
}
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true


# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,jsx,html}]
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

# Indent sass files with 4 spaces
[*.{sass}]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

82 changes: 82 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
extends:
- plugin:react/recommended

env:
browser: true
node: true
es6: true

parserOptions:
ecmaVersion: 6
sourceType: "module"
ecmaFeatures:
jsx: true

globals:
__DEV__: true
__SERVER__: true

plugins:
- react

parser: "babel-eslint"
rules:
react/jsx-uses-vars: 1
react/prop-types: [1, { ignore: [children] }]

semi: 0
key-spacing: 1
curly: 0
consistent-return: 0
space-infix-ops: 1
camelcase: 0
no-spaced-func: 1
no-alert: 1
eol-last: 1
comma-spacing: 1
eqeqeq: 1

# possible errors
comma-dangle: 0
no-cond-assign: 2
no-console: 0
no-constant-condition: 2
no-control-regex: 2
no-debugger: 2
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-empty-character-class: 2
no-empty: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens: 0
no-extra-semi: 2
no-func-assign: 2
no-inner-declarations: 2
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-negated-in-lhs: 2
no-obj-calls: 2
no-regex-spaces: 2
no-sparse-arrays: 2
no-unexpected-multiline: 2
no-unreachable: 2
use-isnan: 2
valid-jsdoc: 2
valid-typeof: 2

no-redeclare: 2

init-declarations: 2
no-catch-shadow: 2
no-delete-var: 2
no-label-var: 2
no-shadow-restricted-names: 2
no-shadow: 2
no-undef-init: 2
no-undef: 2
no-undefined: 2
no-unused-vars: 2
no-use-before-define: 2
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Ignore build files
public

# Ignore my .mertrc file
.mertrc
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# react-webpack-babel-simple-starter
Simple React Webpack Babel Starter Kit

Tired of complicated starters with 200MB of dependencies which are hard to understand and modify?

Try this is a simple [React](https://facebook.github.io/react/), [Webpack](http://webpack.github.io/) and [Babel](https://babeljs.io/) application with nothing else in it.

This is a fork of [react-webpack-babel-simple-starter](https://github.com/alicoding/react-webpack-babel)

### What's in it?

* Simple src/app.jsx and src/app.scss (local module css).
* Webpack configuration for development (with hot reloading) and production (with minification).
* CSS module loading, so you can include your css by ```import styles from './path/to.css';```.
* Both js(x) and css hot loaded during development.

### To run

* You'll need to have [git](https://git-scm.com/) and [node](https://nodejs.org/en/) installed in your system.
* Fork and clone the project:

```
git clone https://github.com/alicoding/react-webpack-babel.git
```

* Then install the dependencies:

```
npm install
```

* Run development server:

```
npm start
```

Open the web browser to `http://localhost:8888/`

### To build the production package

```
npm run build
```

### Nginx Config

Here is an example Nginx config:
```
server {
# ... root and other options
gzip on;
gzip_http_version 1.1;
gzip_types text/plain text/css text/xml application/javascript image/svg+xml;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.html?$ {
expires 1d;
}
location ~ \.(svg|ttf|js|css|svgz|eot|otf|woff|jpg|jpeg|gif|png|ico)$ {
access_log off;
log_not_found off;
expires max;
}
}
```

### Eslint
There is a .eslint.yaml config for eslint ready with React plugin.
To use it, you need to install additional dependencies though:

```
npm install --save-dev eslint eslint-plugin-react
```

To do the actual linting, run:

```
npm run lint
```

### Notes on importing css styles
* styles having /src/ in their absolute path are considered part of the application and exported as local css modules.
* other styles are considered global styles used by many components and are included in the css bundle directly.

### Contribute
Please contribute to the project if you know how to make it better, including this README :)

### Personal Setup
On the personal Setup branch I've added some tools and extra funcitonalities to better suit my needs.
- [babel-plugin-react-html-attrs](https://github.com/insin/babel-plugin-react-html-attrs) Transforms JSX `class` attributes into `className` and `for` attributes into `htmlFor`, allowing you to copy and paste HTML into your React components without having to manually edit these particular attributes each time.
- Personal `.editorconfig` setup
- Re-added `bootstrap` (it was stripped in the original project)
- [react-router](https://github.com/ReactTraining/react-router) basic setup
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>React App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
<div class="container">
<div id="app">Loading...</div>
</div>
<script type="text/javascript" src="/public/bundle.js"></script>
</body>

</html>
64 changes: 64 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "react-webpack-babel",
"version": "0.0.3",
"description": "React Webpack Babel Starter Kit",
"main": "''",
"scripts": {
"build": "webpack --config webpack.production.config.js --progress --profile --colors",
"start": "webpack-dev-server --progress --profile",
"lint": "eslint --ext js --ext jsx src || exit 0",
"dev": "webpack-dashboard -- webpack-dev-server --progress --profile --colors"
},
"repository": {
"type": "git",
"url": "https://github.com/LeonardoGentile/react-webpack-babel-simple-starter"
},
"author": "Leonardo Gentile",
"license": "MIT",
"homepage": "https://github.com/LeonardoGentile/react-webpack-babel-simple-starter#readme",
"dependencies": {
"axios": "^0.15.3",
"classnames": "^2.2.5",
"js-cookie": "^2.1.3",
"mobx": "^3.1.0",
"mobx-react": "^4.1.0",
"react": "15.4.1",
"react-dom": "15.4.1",
"react-router5": "^4.0.1",
"router5": "^4.5.1"
},
"devDependencies": {
"autoprefixer": "^6.7.2",
"babel-core": "6.17.0",
"babel-eslint": "^6.1.2",
"babel-loader": "6.2.7",
"babel-plugin-react-html-attrs": "^2.0.0",
"babel-plugin-transform-class-properties": "^6.16.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "6.16.0",
"babel-preset-react": "6.16.0",
"babel-preset-stage-3": "^6.22.0",
"babel-runtime": "^6.11.6",
"css-loader": "0.26.0",
"eslint": "^3.16.0",
"eslint-plugin-react": "^6.10.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "0.9.0",
"html-webpack-plugin": "^2.22.0",
"lost": "^8.0.0",
"mobx-react-devtools": "^4.2.10",
"node-sass": "^3.10.1",
"postcss-loader": "^1.3.0",
"react-hot-loader": "^3.0.0-beta.6",
"sass-loader": "^4.0.2",
"sass-resources-loader": "^1.2.0",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
"webpack": "1.13.2",
"webpack-cleanup-plugin": "^0.4.1",
"webpack-dashboard": "^0.3.0",
"webpack-dev-server": "1.16.3"
}
}
19 changes: 19 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
'Android >= 4',
'Chrome >= 35',
'Firefox >= 31',
'Explorer >= 9',
'iOS >= 7',
'Opera >= 12',
'Safari >= 7.1',
];

module.exports = {
plugins: [
require('autoprefixer')({ browsers: AUTOPREFIXER_BROWSERS }),
require('lost')
]
}


Loading

0 comments on commit c6dcca7

Please sign in to comment.