diff --git a/.gitignore b/.gitignore index 61b5b9c..c81003e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ config.json mywebsite mywebsite.exe +node_modules +dist \ No newline at end of file diff --git a/client/js/pages/Index.js b/client/js/pages/Index.js new file mode 100644 index 0000000..ece8774 --- /dev/null +++ b/client/js/pages/Index.js @@ -0,0 +1,9 @@ +import React from 'react'; + +export default class Index extends React.Component{ + render(){ + return( +
This is the index test component
+ ); + } +} \ No newline at end of file diff --git a/client/js/routes.js b/client/js/routes.js new file mode 100644 index 0000000..0b81c15 --- /dev/null +++ b/client/js/routes.js @@ -0,0 +1,22 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import {browserHistory, Router, Route, IndexRoute} from 'react-router'; + +import Index from './pages/Index'; + +class App extends React.Component{ + render(){ + return( +
{React.cloneElement(this.props.children, this.props)}
+ ); + } +} + +ReactDOM.render(( + + + + + + +),document.getElementById('app')); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..db89a80 --- /dev/null +++ b/index.html @@ -0,0 +1,24 @@ + + + + + + + + + + mitchel.io + + + + + +
+ + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..48b767a --- /dev/null +++ b/package.json @@ -0,0 +1,51 @@ +{ + "name": "mywebsite", + "version": "1.0.0", + "description": "My personal website built with React and Go", + "main": "index.js", + "scripts": { + "build": "webpack -p", + "c9": "webpack-dev-server --port $PORT --host $IP --hot --content-base dist --history-api-fallback", + "dev": "webpack-dev-server --content-base dist --inline --hot --history-api-fallback", + "prod-linux": "export NODE_ENV=production && webpack -p", + "prod-windows": "set NODE_ENV=production & webpack -p", + "deploy": "goapp deploy", + "serve": "goapp serve" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/mgerb/mywebsite.git" + }, + "author": "Mitchell Gerber", + "license": "ISC", + "bugs": { + "url": "https://github.com/mgerb/mywebsite/issues" + }, + "homepage": "https://github.com/mgerb/mywebsite#readme", + "dependencies": { + "babel": "^6.5.2", + "babel-core": "^6.13.2", + "babel-loader": "^6.2.4", + "babel-plugin-react-html-attrs": "^2.0.0", + "babel-plugin-transform-class-properties": "^6.11.5", + "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-preset-es2015": "^6.13.2", + "babel-preset-react": "^6.11.1", + "babel-preset-stage-0": "^6.5.0", + "css-loader": "^0.23.1", + "exports-loader": "^0.6.3", + "file-loader": "^0.9.0", + "font-awesome": "^4.6.3", + "html-webpack-plugin": "^2.22.0", + "node-sass": "^3.8.0", + "react": "^15.3.0", + "react-dom": "^15.3.0", + "react-router": "^2.6.1", + "sass-loader": "^4.0.0", + "style-loader": "^0.13.1", + "url-loader": "^0.5.7", + "webpack": "^1.13.1", + "webpack-dev-server": "^1.14.1", + "wowjs": "^1.1.3" + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..60890ac --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,53 @@ +var debug = process.env.NODE_ENV !== "production"; +var webpack = require('webpack'); +var path = require('path'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); + +module.exports = { + devtool: debug ? "inline-sourcemap" : null, + entry: "./client/js/routes.js", + module: { + loaders: [ + { + test: /\.js?$/, + exclude: /(node_modules)/, + loader: 'babel-loader', + query: { + presets: ['react', 'es2015', 'stage-0'], + plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'], + } + }, + { test: /\.scss$/, loader: "style-loader!css-loader!sass-loader"}, + { test: /\.css$/, loader: "style-loader!css-loader" }, + { test: /\.png$/, loader: "url-loader?limit=100000&name=images/[hash].[ext]" }, + { test: /\.jpg$/, loader: "url-loader?limit=100000&name=images/[hash].[ext]" }, + { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml&name=images/[hash].[ext]"}, + { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff&name=fonts/[hash].[ext]"}, + { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff&name=fonts/[hash].[ext]"}, + { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream&name=fonts/[hash].[ext]"}, + { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file?name=fonts/[hash].[ext]"}, + { + test: require.resolve('wowjs/dist/wow.js'), + loader: 'exports?this.WOW' + } + ] + }, + output: { + path: __dirname + "/dist/", + publicPath: "/dist/", + filename: "client.min.js" + }, + plugins: debug ? [] : [ + new webpack.optimize.DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), + ], + plugins: [ + new HtmlWebpackPlugin({ + fileName: 'index.html', + template: 'index.html', + inject: 'body', + hash: true + }) + ] +}; \ No newline at end of file