Skip to content

Commit 88ba84d

Browse files
author
Justus Bogner
committed
Added fontawesome; made bootswatch theme configurable in config; added axios example
1 parent 2a047ef commit 88ba84d

File tree

8 files changed

+140
-90
lines changed

8 files changed

+140
-90
lines changed

README.md

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Vue.js TypeScript Frontend Skeleton Project
22

3-
> A skeleton project with Vue.js, TypeScript, Bootstrap, Less, Webpack, and Jest.
3+
> A skeleton project with Vue.js, TypeScript, Bootstrap, Font Awesome, Less, Webpack, and Jest.
44
55
## Structure
66

7-
- `src/app.ts`: main file of the app that loads and configures all dependencies and kickstarts the parent Vue component
8-
- `src/App.vue`: parent Vue component with basic app skeleton with header/nav, body, and footer
9-
- `src/routes.ts`: configuration of routes (`route`: binding a `component` to a certain `path`)
10-
- `src/views/`: directory for all Vues; should be structured according to domain concepts
11-
- `src/common/`: directory for shared functionality that is not specific to a certain Vue or domain concept
12-
- `src/config/index.ts`: configuration file with app or environment specific properties
13-
- `test/`: directory for all tests
7+
- `src/app.ts`: main file of the app that loads and configures all dependencies and kickstarts the parent Vue component
8+
- `src/App.vue`: parent Vue component with basic app skeleton with header/nav, body, and footer
9+
- `src/routes.ts`: configuration of routes (`route`: binding a `component` to a certain `path`)
10+
- `src/views/`: directory for all Vues; should be structured according to domain concepts
11+
- `src/common/`: directory for shared functionality that is not specific to a certain Vue or domain concept
12+
- `src/config/index.ts`: configuration file with app or environment specific properties (e.g. to change the used Bootswatch theme)
13+
- `test/`: directory for all tests
1414

1515
## Build Setup
1616

17-
``` bash
17+
```bash
1818
# install dependencies
1919
npm install
2020

@@ -36,21 +36,7 @@ npm run sonar
3636

3737
## Useful VSCode Extensions
3838

39-
- Vetur (helps with Vue SFCs)
40-
- TSLint (enforces coding rules in `tslint.json`)
41-
- Prettier (formats Vue files)
42-
- EditorConfig (enforces code formatting in `.editorconfig`)
43-
44-
## VSCode Settings
45-
46-
```json
47-
{
48-
"editor.formatOnSave": true,
49-
"prettier.disableLanguages": [
50-
"markdown"
51-
],
52-
"tslint.alwaysShowRuleFailuresAsWarnings": true,
53-
"tslint.autoFixOnSave": true,
54-
"vetur.format.defaultFormatter.html": "js-beautify-html"
55-
}
56-
```
39+
- Vetur (helps with Vue SFCs)
40+
- TSLint (enforces coding rules in `tslint.json`)
41+
- Prettier (formats Vue files)
42+
- EditorConfig (enforces code formatting in `.editorconfig`)

package-lock.json

Lines changed: 52 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "skeleton-vue-typescript",
33
"description": "A web frontend skeleton project with Vue.js, TypeScript, Bootstrap, Less, Webpack, and Jest.",
4-
"version": "0.0.3",
4+
"version": "0.1.0",
55
"license": "Apache-2.0",
66
"author": "Justus Bogner <[email protected]>",
77
"scripts": {
@@ -36,13 +36,16 @@
3636
]
3737
},
3838
"dependencies": {
39+
"@fortawesome/fontawesome-svg-core": "^1.2.10",
40+
"@fortawesome/free-solid-svg-icons": "^5.6.1",
41+
"@fortawesome/vue-fontawesome": "^0.1.3",
3942
"axios": "^0.18.0",
4043
"bootstrap": "^4.1.3",
4144
"bootstrap-vue": "^2.0.0-rc.11",
4245
"bootswatch": "^4.1.3",
4346
"core-js": "^2.6.1",
4447
"moment": "^2.23.0",
45-
"vue": "^2.5.21",
48+
"vue": "2.5.17",
4649
"vue-class-component": "^6.3.2",
4750
"vue-property-decorator": "^7.2.0",
4851
"vue-router": "^3.0.2"
@@ -69,7 +72,7 @@
6972
"typescript": "^3.2.2",
7073
"vue-jest": "^3.0.2",
7174
"vue-loader": "^15.4.2",
72-
"vue-template-compiler": "^2.5.21",
75+
"vue-template-compiler": "2.5.17",
7376
"webpack": "^4.28.0",
7477
"webpack-cli": "^3.1.2",
7578
"webpack-dev-server": "^3.1.10",

src/app.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// Bootstrap CSS
22
import "bootstrap-vue/dist/bootstrap-vue.css";
33
import "bootstrap/dist/css/bootstrap.css";
4-
// Bootswatch theme
5-
import "bootswatch/dist/yeti/bootstrap.min.css";
4+
5+
// Configuration file
6+
import { config } from "./config";
7+
8+
// Bootswatch theme (changeable in the config)
9+
import(`bootswatch/dist/${config.bootswatchTheme}/bootstrap.min.css`);
610

711
// IE polyfills
812
import "core-js/es6/array";
@@ -12,6 +16,18 @@ import "core-js/es7/array";
1216
// Main Vue library
1317
import Vue from "vue";
1418

19+
// Fontawesome icon setup
20+
import { library } from "@fortawesome/fontawesome-svg-core";
21+
// Only import the icons you really use to reduce the size of the import, e.g. 'faCommentDots' (the comment dots icon) instead of 'fas' (all free solid icons)
22+
import {
23+
faCheckSquare,
24+
faCommentDots,
25+
faStar
26+
} from "@fortawesome/free-solid-svg-icons";
27+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
28+
library.add(faCheckSquare, faCommentDots, faStar);
29+
Vue.component("fa-icon", FontAwesomeIcon);
30+
1531
// BootstrapVue UI components library
1632
import BootstrapVue from "bootstrap-vue";
1733
Vue.use(BootstrapVue);
@@ -24,7 +40,9 @@ import VueRouter from "vue-router";
2440
Vue.use(VueRouter);
2541
import routes from "./routes";
2642
const router = new VueRouter({
27-
mode: "history",
43+
// Use history mode to get rid of the # in the URL
44+
// This requires server-side changes though to have stateless URLs (see: https://router.vuejs.org/guide/essentials/history-mode.html)
45+
// mode: "history",
2846
routes
2947
});
3048

src/config/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// config for this frontend project
22
export const config = {
3+
// identifier used for localStorage
4+
appId: "skeleton-vue-typescript",
5+
appTitle: "Vue.js TypeScript Skeleton",
36

4-
// identifier used for localStorage
5-
appId: "skeleton-vue-typescript",
6-
appTitle: "Vue.js TypeScript Skeleton",
7+
// Bootswatch Theme (https://bootswatch.com)
8+
bootswatchTheme: "flatly",
79

8-
// build Date (replaced by webpack)
9-
buildDate: "$BUILDDATE",
10-
// version (replaced by webpack)
11-
version: "$VERSION"
10+
// build Date (replaced by webpack)
11+
buildDate: "$BUILDDATE",
12+
// version (replaced by webpack)
13+
version: "$VERSION"
1214
};

0 commit comments

Comments
 (0)