Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*.iml
target/
logs/

node_modules/
**/bundle.js
**/npm-debug.log
8 changes: 1 addition & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
</dependency>

<!-- Front-end -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>react</artifactId>
<version>0.13.3</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
Expand All @@ -89,4 +83,4 @@



</project>
</project>
10 changes: 4 additions & 6 deletions src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
<meta charset="UTF-8">
<title>Amugona</title>
<link type="text/css" rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.min.css" />
<script src="webjars/react/0.13.3/react.min.js"></script>
<script src="webjars/react/0.13.3/JSXTransformer.js"></script>

<link type="text/css" rel="stylesheet" href="styles/main.css" />
<script type="text/jsx" src="scripts/main.js"></script>
</head>
<body>
<div id="root"></div>
<!-- <script type="text/javascript" src="scripts/bundle.js"></script> -->
<script type="text/javascript" src="http://localhost:3003/bundle.js"></script>
</body>
</html>
</html>
1,034 changes: 1,034 additions & 0 deletions src/main/resources/static/scripts/bundle.js

Large diffs are not rendered by default.

99 changes: 0 additions & 99 deletions src/main/resources/static/scripts/main.js

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/static/scripts/nav.js

This file was deleted.

16 changes: 16 additions & 0 deletions src/main/resources/webapp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"stage": 0,
"plugins": [
"react-transform"
],
"extra": {
"react-transform": [{
"target": "react-transform-webpack-hmr",
"imports": ["react"],
"locals": ["module"]
}, {
"target": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}]
}
}
28 changes: 28 additions & 0 deletions src/main/resources/webapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Install
Install node_modules(react/webpack/etc...)

```
npm install
```

### Webpack

Build bundle.js : Make sure that bundle.js file src should be "scripts/bundle.js"

```
npm run build
```

Watch mode : Make sure that bundle.js file src should be "localhost:3003/bundle.js"

```
npm run watch
```

### Folders

`components` - React components

`containers` - React pages

`styles` - css
34 changes: 34 additions & 0 deletions src/main/resources/webapp/components/Nav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { Component } from 'react'

export default class Nav extends Component {
render() {
return (
<nav className="navbar navbar-fixed-top">
<div className="container">
<div className="navbar-header">
<button type="button" className="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span className="sr-only">Toggle navigation</span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
<span className="icon-bar"></span>
</button>
<a className="navbar-brand" href="/">A.MU.GO.NA</a>
</div>
<div id="navbar" className="collapse navbar-collapse">
<ul className="nav navbar-nav">
<li className="active"><a href="/">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<ul className="nav navbar-nav navbar-right">
<li className="btn-group">
<button type="button" className="btn btn-success navbar-btn">Sign up</button>
<button type="button" className="btn btn-default navbar-btn">Sign in</button>
</li>
</ul>
</div>
</div>
</nav>
)
}
}
33 changes: 33 additions & 0 deletions src/main/resources/webapp/containers/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { Component } from 'react'
import Home from './Home'
import Signup from './Signup'

export default class App extends Component {
constructor(props) {
super(props)
this.state = { route: window.location.hash.substr(1) }
}

componentDidMount() {
window.addEventListener('hashchange', () => {
this.setState({
route: window.location.hash.substr(1)
})
})
}

render() {
var Child
switch (this.state.route) {
case "home":
Child = Home
break
case "signup":
Child = Signup
break
default:
Child = Home
}
return (<Child/>);
}
}
21 changes: 21 additions & 0 deletions src/main/resources/webapp/containers/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { Component } from 'react'
import Nav from '../components/Nav'

export default class Home extends Component {
render() {
return (
<div>
<Nav/>
<div className="container">
<div className="starter-template">
<h1>Home Page</h1>
<p className="lead">
Use this document as a way to quickly start any new project.
<br/> All you get is this text and a mostly barebones HTML document.
</p>
</div>
</div>
</div>
)
}
}
21 changes: 21 additions & 0 deletions src/main/resources/webapp/containers/Signup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { Component } from 'react'
import Nav from '../components/Nav'

export default class Signup extends Component {
render() {
return (
<div>
<Nav/>
<div className="container">
<div className="starter-template">
<h1>Sign-up Page</h1>
<p className="lead">
Use this document as a way to quickly start any new project.
<br/> All you get is this text and a mostly barebones HTML document.
</p>
</div>
</div>
</div>
)
}
}
5 changes: 5 additions & 0 deletions src/main/resources/webapp/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require('./styles/main.css')
import React from 'react'
import App from './containers/App'

React.render(<App />, document.getElementById('root'))
38 changes: 38 additions & 0 deletions src/main/resources/webapp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "amugona",
"version": "1.0.0",
"description": "What's up bro?",
"main": "index.js",
"scripts": {
"build": "webpack --progress --profile --colors",
"watch": "webpack-dev-server --progress --inline --hot --port 3003",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/keesun/amugona.git"
},
"keywords": [
"amugona",
"boot"
],
"author": "keesun",
"license": "ISC",
"bugs": {
"url": "https://github.com/keesun/amugona/issues"
},
"homepage": "https://github.com/keesun/amugona#readme",
"devDependencies": {
"babel-core": "^5.8.24",
"babel-loader": "^5.3.2",
"babel-plugin-react-transform": "^1.0.3",
"css-loader": "^0.18.0",
"react": "^0.13.3",
"react-transform-catch-errors": "^0.1.1",
"react-transform-webpack-hmr": "^0.1.4",
"redbox-react": "^1.0.3",
"style-loader": "^0.12.3",
"webpack": "^1.12.1",
"webpack-dev-server": "^1.10.1"
}
}
24 changes: 24 additions & 0 deletions src/main/resources/webapp/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var path = require('path'),
webpack = require('webpack');

module.exports = {
devtool: 'cheap-module-eval-source-map',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keesun devtool: 'eval' 빌드속도짱빠름..

entry: './main.js',
output: {
path: path.join(__dirname, '../static/scripts'),
filename: 'bundle.js',
},
resolve: {
extensions: ['', '.js']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
module: {
loaders: [
{test: /\.js$/, loader: 'babel', exclude: /node_modules/},
{test: /\.css$/, loader: 'style!css'}
]
}
};