boilerplate

This commit is contained in:
Antti Pilto 2016-07-27 20:13:08 +03:00
parent 2dade77ee1
commit d6570c5045
9 changed files with 189 additions and 2 deletions

3
.babelrc Normal file
View file

@ -0,0 +1,3 @@
{
"presets" : ["es2015", "react"]
}

2
.env.example Normal file
View file

@ -0,0 +1,2 @@
AUTH0_CLIENT_ID='BUIJSW9x60sIHBw8Kd9EmCbj8eDIFxDC'
AUTH0_DOMAIN='samples.auth0.com'

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/node_modules/
/dist/
/dev_content/
/index.html
deldist.bat
.env

View file

@ -4,7 +4,9 @@
"description": "Application for studying hiragana & katakana characters.", "description": "Application for studying hiragana & katakana characters.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --host 0.0.0.0",
"build": "webpack -p --config webpack.config.prod.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -15,5 +17,27 @@
"bugs": { "bugs": {
"url": "https://github.com/anzzstuff/kanaquiz/issues" "url": "https://github.com/anzzstuff/kanaquiz/issues"
}, },
"homepage": "https://github.com/anzzstuff/kanaquiz#readme" "homepage": "https://github.com/anzzstuff/kanaquiz#readme",
"devDependencies": {
"autoprefixer": "^6.3.7",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"css-loader": "^0.23.1",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"postcss": "^5.0.21",
"postcss-loader": "^0.9.1",
"precss": "^1.4.0",
"react-hot-loader": "^1.3.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"postcss": "^5.1.0",
"react": "^15.2.1",
"react-dom": "^15.2.1"
}
} }

View file

@ -0,0 +1,11 @@
import React, { Component } from 'react';
class App extends Component {
render() {
return (
<div>hello world</div>
)
}
}
export default App;

14
src/index.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kana Quiz 2: Learn hiragana & katakana fast and easy</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Author" content="Antti Pilto">
<meta name="Description" content="Application for studying hiragana & katakana characters.">
</head>
<body>
<div class="container"></div>
</body>
</html>

6
src/index.js Normal file
View file

@ -0,0 +1,6 @@
import React from 'react';
import { render } from 'react-dom';
import App from './components/App/App';
let element = React.createElement(App, {});
render(element, document.querySelector('.container'));

55
webpack.config.js Normal file
View file

@ -0,0 +1,55 @@
var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors
'./src/index'
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new HtmlWebPackPlugin({
template: 'src/index.html',
filename: '../index.html'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel']
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=25000'
},
{
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
},
postcss: function() {
return [autoprefixer, precss];
}
};

66
webpack.config.prod.js Normal file
View file

@ -0,0 +1,66 @@
var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'cheap-module-source-map',
entry: [
'./src/index'
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './dist/',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.DefinePlugin({
'process.env':{
'NODE_ENV': JSON.stringify('production')
}
}),
new HtmlWebPackPlugin({
template: 'src/index.html',
filename: '../index.html'
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress:{
screw_ie8: true,
warnings: false
},
}),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel']
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
},
postcss: function() {
return [autoprefixer, precss];
}
};