Skip to content

Commit

Permalink
initial react config and bg
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohanhacker committed Mar 4, 2017
1 parent a423f16 commit 8d2c1d7
Show file tree
Hide file tree
Showing 16 changed files with 5,829 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["es2015", {"modules": false}],
"stage-2",
"react"
],
"plugins": [
"react-hot-loader/babel"
]
}
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"env": {
"browser": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"quotes": [2, "single"],
"strict": [2, "never"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2
},
"plugins": [
"react"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
6 changes: 6 additions & 0 deletions dist/static/bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/static/bundle.js.map

Large diffs are not rendered by default.

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>
<head>
<title>Rohan Malhotra</title>
<link rel="stylesheet" href="./static/css/index.css">
</head>
<body>
<div id='root'>
</div>
<script src="/static/bundle.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "rohanm.me",
"version": "1.0.0",
"description": "my personal website",
"main": "./js/index.js",
"repository": "[email protected]:Rohanhacker/rohanm.me.git",
"author": "rohanhacker <[email protected]>",
"license": "MIT",
"scripts": {
"start": "webpack-dev-server",
"lint": "eslint src",
"build": "NODE_ENV=production webpack -p --config webpack.config.production.js"
},
"dependencies": {
"babel-eslint": "^7.1.1",
"eslint": "^3.17.0",
"eslint-plugin-react": "^6.10.0",
"normalize-css": "^2.3.1",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-router-dom": "next"
},
"devDependencies": {
"babel-core": "6.13.2",
"babel-loader": "6.2.4",
"babel-preset-es2015": "6.13.2",
"babel-preset-react": "6.11.1",
"babel-preset-stage-2": "6.13.0",
"css-loader": "0.23.1",
"image-webpack-loader": "^3.2.0",
"postcss-loader": "0.9.1",
"react-hot-loader": "3.0.0-beta.6",
"style-loader": "0.13.1",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.0"
}
}
24 changes: 24 additions & 0 deletions src/containers/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.background {
background: linear-gradient(40deg,#134E5E,transparent 100%),
linear-gradient(230deg, #71B280, transparent),
#ffa949 url('../../static/img/bg2.jpg') center;
background-size: cover;
height: 96.9vh;
width: 98vw;
margin: 10px;
overflow: hidden;
}

.container {
overflow: auto;
padding: 20px;
height: 100%;
position: fixed;
top: 10px;
left: 20px;
right: -15px;
}

.content {
min-height: 2000px;
}
15 changes: 15 additions & 0 deletions src/containers/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import styles from './App.css';

const App = () => (
<div>
<div className={styles.background}> </div>
<div className={styles.container} >
<div className={styles.content}>
s
</div>
</div>
</div>
);

export default App;
24 changes: 24 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { AppContainer } from 'react-hot-loader';

import App from './containers/App';

const render = (Component) => {
ReactDOM.render(
<AppContainer>
<Component/>
</AppContainer>,
document.getElementById('root')
);
};

render(App);

// Hot Module Replacement API
if (module.hot) {
module.hot.accept('./containers/App', () => {
render(App)
});
}
3 changes: 3 additions & 0 deletions static/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
margin: 0;
}
Binary file added static/img/bg1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/bg2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
entry: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index.js',
],

output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/static/'
},

devtool: 'inline-source-map',

module: {
rules: [
{
test: /\.jsx?$/,
use: [
'babel-loader',
],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader?modules',
'postcss-loader',
],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
},
],
},

plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin()
],

devServer: {
host: 'localhost',
port: 3000,
historyApiFallback: true,
hot: true,
},
};
38 changes: 38 additions & 0 deletions webpack.config.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const path = require('path');
const webpack = require('webpack');

module.exports = {
entry: './src/index.js',
output: {
filename: 'static/bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/'
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/,
use: [
'babel-loader'
],
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader?modules',
'postcss-loader',
],
},
]
},

plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
comments: false
})
]
};
Loading

0 comments on commit 8d2c1d7

Please sign in to comment.