├── settings.gradle ├── src ├── main │ ├── resources │ │ ├── application.properties │ │ └── templates │ │ │ └── home.ftl │ └── java │ │ └── com │ │ └── github │ │ └── kingbbode │ │ └── springbootvuejs │ │ ├── SpringBootVuejsApplication.java │ │ ├── dto │ │ └── TodoResponse.java │ │ └── controller │ │ ├── TodoController.java │ │ └── TodoRestController.java ├── front │ ├── store │ │ ├── store.js │ │ └── modules │ │ │ └── userInfo.js │ ├── template │ │ ├── MainFooter.vue │ │ └── MainHeader.vue │ ├── router │ │ └── router.js │ ├── main.js │ ├── components │ │ ├── TodoList.vue │ │ ├── UserList.vue │ │ └── UserInfo.vue │ ├── pages │ │ └── Home.vue │ └── App.vue └── test │ └── java │ └── com │ └── github │ └── kingbbode │ └── springbootvuejs │ └── SpringBootVuejsApplicationTests.java ├── images ├── app.png └── build.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── webpack.prod.js ├── .gitignore ├── webpack.dev.js ├── package.json ├── README.md ├── gradlew.bat ├── webpack.config.js └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'spring-boot-vuejs' 2 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mvc.static-path-pattern=/static/** -------------------------------------------------------------------------------- /images/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingbbode/spring-vuejs/HEAD/images/app.png -------------------------------------------------------------------------------- /images/build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingbbode/spring-vuejs/HEAD/images/build.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingbbode/spring-vuejs/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/front/store/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import UserInfoModule from './modules/userInfo' 4 | 5 | Vue.use(Vuex); 6 | 7 | export default new Vuex.Store({ 8 | modules : { 9 | userInfo : UserInfoModule 10 | } 11 | }) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Feb 06 12:27:20 CET 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip 7 | -------------------------------------------------------------------------------- /src/front/template/MainFooter.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /webpack.prod.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); 3 | module.exports = { 4 | plugins: [ 5 | new webpack.LoaderOptionsPlugin({ 6 | minimize: true, 7 | debug: false 8 | }), 9 | new UglifyJSPlugin() 10 | ] 11 | }; -------------------------------------------------------------------------------- /src/front/router/router.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue" 2 | import VueRouter from "vue-router"; 3 | import Home from "../pages/Home.vue" 4 | 5 | Vue.use(VueRouter); 6 | 7 | export default new VueRouter({ 8 | mode: 'history', 9 | routes: [ 10 | { path: '/', component: Home }, 11 | { path: '/:user', component: Home } 12 | ] 13 | }); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | 27 | node_modules 28 | static 29 | out -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | 3 | module.exports = { 4 | devtool: 'inline-source-map', 5 | devServer: { 6 | historyApiFallback: true, 7 | publicPath: '/static/', 8 | host: "0.0.0.0", 9 | port: 3000, 10 | proxy: { 11 | "**": "http://localhost:8080" 12 | } 13 | }, 14 | plugins: [ 15 | new webpack.NamedModulesPlugin() 16 | ] 17 | }; 18 | -------------------------------------------------------------------------------- /src/front/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Store from "./store/store" 3 | import Router from "./router/router" 4 | import App from "./App.vue" 5 | 6 | import 'vue-material/dist/vue-material.min.css' 7 | import 'vue-material/dist/theme/black-green-light.css' 8 | import VueMaterial from 'vue-material' 9 | 10 | Vue.use(VueMaterial); 11 | 12 | new Vue({ 13 | el: '#main', 14 | render: h => h(App), 15 | store: Store, 16 | router: Router 17 | }); -------------------------------------------------------------------------------- /src/main/java/com/github/kingbbode/springbootvuejs/SpringBootVuejsApplication.java: -------------------------------------------------------------------------------- 1 | package com.github.kingbbode.springbootvuejs; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootVuejsApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootVuejsApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/java/com/github/kingbbode/springbootvuejs/SpringBootVuejsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.github.kingbbode.springbootvuejs; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SpringBootVuejsApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/templates/home.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /src/front/components/TodoList.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/com/github/kingbbode/springbootvuejs/dto/TodoResponse.java: -------------------------------------------------------------------------------- 1 | package com.github.kingbbode.springbootvuejs.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Builder; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | import java.util.List; 9 | 10 | @Getter 11 | @Setter 12 | @JsonInclude(JsonInclude.Include.NON_NULL) 13 | public class TodoResponse { 14 | private TodoInfo info; 15 | private List todoList; 16 | 17 | @Builder 18 | public TodoResponse(String id, String img, String company, String bio, List todoList) { 19 | this.info = TodoInfo.builder().id(id).company(company).img(img).bio(bio).build(); 20 | this.todoList = todoList; 21 | } 22 | 23 | @Getter 24 | @Setter 25 | @Builder 26 | public static class TodoInfo { 27 | private String id; 28 | private String img; 29 | private String company; 30 | private String bio; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/github/kingbbode/springbootvuejs/controller/TodoController.java: -------------------------------------------------------------------------------- 1 | package com.github.kingbbode.springbootvuejs.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.util.StringUtils; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | @Controller 13 | public class TodoController { 14 | 15 | private static final List USERS = Collections.unmodifiableList(Arrays.asList("kingbbode", "jojoldu")); 16 | 17 | @GetMapping("/") 18 | public String home() { 19 | return "home"; 20 | } 21 | 22 | @GetMapping("/{user}") 23 | public String home(@PathVariable String user) { 24 | if(!USERS.contains(user)) { 25 | throw new IllegalArgumentException(); 26 | } 27 | return "home"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/front/components/UserList.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 32 | 33 | -------------------------------------------------------------------------------- /src/front/components/UserInfo.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 32 | 33 | -------------------------------------------------------------------------------- /src/front/pages/Home.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 42 | 43 | -------------------------------------------------------------------------------- /src/front/store/modules/userInfo.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import Vue from "vue"; 3 | 4 | export default { 5 | namespaced: true, 6 | state: { 7 | info : { 8 | id:'', 9 | img : '', 10 | company : '', 11 | bio : '' 12 | }, 13 | todoList : [] 14 | }, 15 | mutations: { 16 | setInfo(state, info) { 17 | _.forEach(info, function(value, key){ 18 | Vue.set(state.info, key, value); 19 | }); 20 | }, 21 | addTodoList(state, projects) { 22 | state.todoList = []; 23 | projects.forEach(project=> { 24 | state.todoList.push(project); 25 | }); 26 | } 27 | }, 28 | actions: { 29 | fetchInfo({ commit }, args) { 30 | axios.get('/user/info/' + args.name).then((response) => { 31 | commit("setInfo", response.data.info); 32 | commit("addTodoList", response.data.todoList); 33 | }); 34 | } 35 | }, 36 | getters: { 37 | getUserInfo(state) { 38 | return state.info; 39 | }, 40 | getTodoList(state) { 41 | return state.todoList; 42 | } 43 | } 44 | }; -------------------------------------------------------------------------------- /src/main/java/com/github/kingbbode/springbootvuejs/controller/TodoRestController.java: -------------------------------------------------------------------------------- 1 | package com.github.kingbbode.springbootvuejs.controller; 2 | 3 | import com.github.kingbbode.springbootvuejs.dto.TodoResponse; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.PathVariable; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import java.util.Arrays; 10 | 11 | @RequestMapping("/user") 12 | @RestController 13 | public class TodoRestController { 14 | 15 | @GetMapping("/info/{id}") 16 | private TodoResponse getUserInfo(@PathVariable String id) { 17 | if("kingbbode".equals(id)) { 18 | return TodoResponse.builder() 19 | .id("kingbbode") 20 | .img("https://avatars3.githubusercontent.com/u/17121431?v=4") 21 | .company("@zuminternet -> @woowabros") 22 | .todoList(Arrays.asList("회사 적응", "개인 플젝 오픈")) 23 | .build(); 24 | }else if("jojoldu".equals(id)) { 25 | return TodoResponse.builder() 26 | .id("jojoldu") 27 | .img("https://avatars0.githubusercontent.com/u/7760496?v=4") 28 | .company("@zuminternet -> @woowabros") 29 | .todoList(Arrays.asList("초개모 번영", "광고비 많이 벌기", "책 제안받기", "강사 제안받기")) 30 | .bio("기억보단 기록을..") 31 | .build(); 32 | } 33 | throw new IllegalArgumentException("하지마세요."); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spring-boot-vuejs", 3 | "version": "1.0.0", 4 | "description": "For Developer", 5 | "author": { 6 | "name": "kingbbode", 7 | "email": "kingbbode@gmail.com", 8 | "url": "http://github.com/kingbbode" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.18.0", 12 | "lodash": "^4.17.5", 13 | "vue": "^2.2.6", 14 | "vue-material": "^1.0.0-beta-7", 15 | "vue-router": "^2.8.1", 16 | "vue-template-compiler": "^2.5.16", 17 | "vuex": "^3.0.1" 18 | }, 19 | "devDependencies": { 20 | "babel-core": "6.24.1", 21 | "babel-eslint": "7.2.3", 22 | "babel-loader": "7.0.0", 23 | "babel-preset-es2015": "6.24.1", 24 | "css-loader": "^0.28.11", 25 | "extract-text-webpack-plugin": "^3.0.2", 26 | "file-loader": "^1.1.11", 27 | "style-loader": "^0.20.3", 28 | "uglifyjs-webpack-plugin": "^1.2.4", 29 | "url-loader": "^1.0.1", 30 | "vue-loader": "^14.2.1", 31 | "webpack": "3.2.0", 32 | "webpack-dev-server": "2.6.1", 33 | "webpack-merge": "4.1.0" 34 | }, 35 | "engines": { 36 | "node": ">= 6.9.4" 37 | }, 38 | "repository": { 39 | "type": "git", 40 | "url": "https://github.com/npm/npm.git" 41 | }, 42 | "licenses": [ 43 | { 44 | "type": "MIT", 45 | "url": "http://www.opensource.org/licenses/MIT" 46 | } 47 | ], 48 | "scripts": { 49 | "error": "webpack --display-error-details", 50 | "start": "webpack-dev-server --env=dev --progress --inline", 51 | "dev": "webpack --env=dev --progress --profile --colors", 52 | "build": "webpack --env=prod --progress --profile --colors", 53 | "test": "echo \"Error: no test specified\" && exit 1" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/front/App.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 27 | 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring + Vue.js 2 | 3 | 스프링과 뷰가 어떻게 한 프로젝트 안에서 동작할 수 있을지 잡아본 구조이다. (꼭 Vue가 아니더라도, 어떠한 Frontend 라도 관계없다) 4 | 5 | ![의뢰인](./images/app.png) 6 | 7 | `Spring`과 `Vue.js`를 한 프로젝트 안에서 개발하는 간단한 예제 프로젝트! 8 | 9 | 이지만, 사실 떨어져 있어도 상관없을 만큼 관계가 없다. 그러니 개발은 각각 `Spring`, `Vue.js` 를 하면 된다. 10 | 11 | 중요한 것은 한 어플리케이션에서 효율적으로 개발하기 위한 환경일 것이다. 12 | 13 | ## Webpack 14 | 15 | > Vue Cli 를 통해 설치하면 더 안정적인 Webpack 설정을 얻을 수 있다. 하지만 지극히 Front End 위주적인 환경을 제공해주기도 하고, 16 | 이 프로젝트에서 필요한 양 이상의 설정이 더욱 복잡함을 가중시켜, 약 1년 전 설정했던 Webpack 설정을 그대로 사용했다. 17 | 18 | - 한 프로젝트에 있지만, 철저히 분리해야 복잡도를 줄일 수 있다. 그래서 src 하위에 front 라는 디렉토리를 만들고 그곳에서 모든 프론트엔드 관련 작업을 하도록 한다. (폴더 구조는 선호하는 구조로 잡으면 된다.) 19 | - 빌드 시 불필요한 파일(번들되기 전 파일, 미사용 이미지 등)이 같이 패키징 되는 더러운 상황과, 이를 방지하기 위해 빌드 전 resource directory 에 불필요한 파일을 매번 삭제해야하는 불필요한 행위를 줄여줄 수 있다. 20 | 21 | - Webpack 의 bundle 최종 경로가, Spring 의 resource static path 를 향하도록 한다. 22 | - 최종 bundle 된 파일을 다시 copy 하는 불필요한 행위를 줄여줄 수 있다. 23 | - webpack devServer 환경과 함께 사용하면, 스프링에서는 동일한 로직으로 운영, 개발 등 환경을 운영할 수 있다. (Backend Template 에서 js, css 등의 파일명을 교체하거나 경로를 조작하는 불필요한 행위를 줄여줄 수 있다.) 24 | 25 | ```js 26 | entry: { 27 | app: path.resolve(__dirname, 'src/front/main.js') 28 | }, 29 | output: { 30 | path: path.resolve(__dirname, 'src/main/resources/static') 31 | ... 32 | } 33 | ``` 34 | 35 | ## 개발 36 | 37 | 두번 실행하는게 귀찮지만, 비교적 간단하다. 38 | 39 | 1. Spring WebApplication 을 구동한다. 40 | 41 | 2. 터미널에서 `npm run start` 를 실행하여 webpack devServer 를 구동한다. 42 | 43 | - 이 프로젝트의 `package.json` 에는 webpack 을 구동하는 script 를 선언해두었다. `start` 명령도 그 중 하나이다. 44 | - start : webpack devServer 구동 45 | - dev : 개발 환경 webpack - 압축, 난독화되지 않은 번들 파일 생성. 46 | - build : 운영 환경 webpack - 압축, 난독화된 번들 파일 생성. 47 | 48 | 3. spring devtools 와 webpack devServer 환경에서 양쪽을 오가며 실시간으로 개발을 한다. 49 | 50 | ## 빌드 51 | 52 | 배포 또한 매우 단순하다. 53 | 54 | gradle 에서 npm 명령을 사용할 수 있는 플로그인을 사용하여, build 환경의 webpack 을 실행시켜주는 Task 를 아래와 같이 간단히 만들 수 있다. 55 | 56 | 그리고 build 과정 중 resources 를 생성하는 순서 앞에 끼어넣어준다. 57 | 58 | webpack의 bundle이 자동으로 `Spring` 의 `resources path` 하위에 파일을 넣어주므로, 추가적인 것은 필요없다. 59 | 60 | 61 | ``` 62 | task webpack(type: NpmTask, dependsOn: 'npmInstall') { 63 | args = ['run', 'build'] 64 | } 65 | 66 | processResources.dependsOn 'webpack' 67 | ``` 68 | 69 | 아무 특별한 것 없이 `gradle` 의 `build task` 를 실행하면 된다. 70 | 71 | 그러면 build 된 jar 파일 안에 static 파일들이 잘 옮겨진 것을 볼 수 있다. 72 | 73 | ![빌드 후 옮겨진 파일](./images/build.png) -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const path = require('path'); 3 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | const webpackMerge = require('webpack-merge'); 5 | 6 | const config = { 7 | entry: { 8 | app: path.resolve(__dirname, 'src/front/main.js') 9 | }, 10 | output: { 11 | path: path.resolve(__dirname, 'src/main/resources/static'), 12 | filename: 'js/[name].js' 13 | }, 14 | module: { 15 | rules: [ 16 | { 17 | test: /\.vue$/, 18 | loader: 'vue-loader', 19 | options: { 20 | extractCSS: true 21 | } 22 | }, 23 | { 24 | test: /\.js$/, 25 | exclude: /node_modules/, 26 | use: [{ 27 | loader: 'babel-loader', 28 | options: { 29 | presets: [ 30 | ['es2015', {modules: false}] 31 | ] 32 | } 33 | }] 34 | }, 35 | { 36 | test: /\.css$/, 37 | loader: ExtractTextPlugin.extract({ 38 | fallback: "style-loader", 39 | use: "css-loader", 40 | }) 41 | }, 42 | { 43 | test: /\.(jpe?g|png|gif|svg)$/, 44 | loader: 'url-loader', 45 | options: { 46 | publicPath : '/static/', 47 | name : 'images/[name].[ext]', 48 | limit : 1 49 | } 50 | }, 51 | { 52 | test: /\.ico$/, 53 | loader: 'file-loader', 54 | options: { 55 | publicPath : '/static/', 56 | name : 'icons/[name].[ext]', 57 | limit : 1 58 | } 59 | }, 60 | { 61 | test: /\.(eot|svg|ttf|woff|woff2)$/, 62 | loader: 'url-loader', 63 | options: { 64 | publicPath : '/static/', 65 | name : 'fonts/[name].[ext]', 66 | limit : 1 67 | } 68 | } 69 | ] 70 | }, 71 | plugins : [ 72 | new webpack.ProvidePlugin({ 73 | _ : "lodash" 74 | }), 75 | new ExtractTextPlugin('css/[name].css') 76 | ] 77 | }; 78 | 79 | module.exports = function(env) { 80 | return webpackMerge(config, require(`./webpack.${env}.js`)); 81 | }; 82 | -------------------------------------------------------------------------------- /src/front/template/MainHeader.vue: -------------------------------------------------------------------------------- 1 | 85 | 86 | 96 | 97 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save ( ) { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | --------------------------------------------------------------------------------