added javascript

This commit is contained in:
aj 2019-06-03 15:53:58 +01:00
parent a5d07659eb
commit 739a7be1ad
12 changed files with 5586 additions and 0 deletions

3
.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["@babel/env", "@babel/preset-react"]
}

View File

@ -19,3 +19,4 @@ __pycache__/
/setup.cfg /setup.cfg
env env
node_modules/

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
node_modules/
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
*/__pycache__/* */__pycache__/*
*.py[cod] *.py[cod]

5455
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

36
package.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "sarsoo.xyz",
"version": "1.0.0",
"description": "sarsoo web",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js",
"devbuild": "webpack --mode development --config webpack.config.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Sarsoo/sarsoo.xyz.git"
},
"author": "sarsoo",
"license": "ISC",
"bugs": {
"url": "https://github.com/Sarsoo/sarsoo.xyz/issues"
},
"homepage": "https://github.com/Sarsoo/sarsoo.xyz#readme",
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"css-loader": "^2.1.1",
"style-loader": "^0.23.1",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
},
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}

View File

@ -12,6 +12,9 @@
<link rel="manifest" href="https://storage.googleapis.com/sarsooxyzstatic/site.webmanifest"> <link rel="manifest" href="https://storage.googleapis.com/sarsooxyzstatic/site.webmanifest">
<link rel="mask-icon" href="https://storage.googleapis.com/sarsooxyzstatic/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="https://storage.googleapis.com/sarsooxyzstatic/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://storage.googleapis.com/sarsooxyzstatic/favicon.ico"> <link rel="shortcut icon" href="https://storage.googleapis.com/sarsooxyzstatic/favicon.ico">
{% block scripts %}{% endblock %}
</head> </head>
<body> <body>
<div> <div>

View File

@ -2,6 +2,10 @@
{% block title %}home{% endblock %} {% block title %}home{% endblock %}
{% block scripts %}
{% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -9,6 +13,7 @@
<p>electronic engineering student / disney intern</p> <p>electronic engineering student / disney intern</p>
<p>proficient in C, Java, Python</p> <p>proficient in C, Java, Python</p>
<p id="root"></p>
{% if splash %}<p>{{ splash }}</p>{% endif %} {% if splash %}<p>{{ splash }}</p>{% endif %}
</div> </div>
<div class="col-3 profile"> <div class="col-3 profile">
@ -22,4 +27,5 @@
<img src="{{ staticroot }}art/{{ image.file_name }}.jpg" alt="{{ image.file_name }}" class="pad-4"> <img src="{{ staticroot }}art/{{ image.file_name }}.jpg" alt="{{ image.file_name }}" class="pad-4">
{% endfor %} {% endfor %}
</div> </div>
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
{% endblock %} {% endblock %}

15
src/js/App.js Normal file
View File

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

6
src/js/index.js Normal file
View File

@ -0,0 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App.js";
ReactDOM.render(<App />, document.getElementById('root'));

32
static/js/main.js Normal file

File diff suppressed because one or more lines are too long

26
webpack.config.js Normal file
View File

@ -0,0 +1,26 @@
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: './src/js/index.js',
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
options: { presets: ["@babel/env"] }
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
]
},
resolve: { extensions: ["*", ".js", ".jsx"] },
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'static/js')
}
};