Skip to content

Commit 456f258

Browse files
committed
docs(template): added basic template files
1 parent 4fe44b1 commit 456f258

16 files changed

+202
-0
lines changed

template/.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('begin-project/lint');

template/.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.DS_Store
3+
npm-debug.log
4+
package-lock.json
5+
dump.rdb
6+
yarn-error.log
7+
dist/

template/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Begin-build generated template
2+
3+
## start your development server
4+
5+
```bash
6+
$ npm run b start
7+
```
8+
9+
### -- OR --
10+
With [Yarn](https://yarnpkg.com):
11+
12+
```bash
13+
$ yarn b start
14+
```
15+
16+
Then navigate to [localhost:8080](http://localhost:8080)

template/client/.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
module.exports = require('begin-project/lint/client');

template/client/app/global.sass

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@import ../variables
2+
@import ~frow/frow
3+
4+
// TODO: add global Sass rules here
5+
6+
html, body
7+
height: 100%

template/client/app/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// TODO: modify app component
2+
module.exports = {
3+
// components: {
4+
// // Import SVGs as components and style them as HTML
5+
// logoSvg: require('./images/logo.svg'),
6+
// },
7+
};

template/client/app/style.sass

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import ../variables
2+
3+
// TODO: app component specific Sass rules here
4+
5+
main
6+
display: block

template/client/app/template.pug

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#main.height-100
2+
// TODO: app component template here
3+
h1 begin-build
4+
h2 Edit me: template.pug in the app/ directory
5+
transition
6+
router-view

template/client/app/vue.pug

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends ~begin-build/component/template
2+
3+
prepend styles
4+
+global("./global.sass")

template/client/favicon.png

478 Bytes
Loading

template/client/index.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let build = require('begin-build');
2+
3+
// TODO: initialize your Vuex store directory or remove
4+
// let { context } = require('begin-build/store');
5+
//
6+
// let store = context(module, require.context('./store', true, /\.js$/));
7+
8+
module.exports = build({
9+
components: { app: require('./app/vue.pug') },
10+
// TODO: configure your Vue router here or remove
11+
// router: {
12+
// routes: [
13+
// {
14+
// name: 'home',
15+
// path: '/',
16+
// component: require('./home/vue.pug'),
17+
// },
18+
// {
19+
// name: '404',
20+
// path: '/404',
21+
// component: require('./404/vue.pug'),
22+
// },
23+
// {
24+
// path: '*',
25+
// redirect: '/',
26+
// },
27+
// ],
28+
// },
29+
});
30+

template/client/index.pug

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends ~begin-build/index.pug
2+
3+
append meta
4+
meta(name="description", content="Your description here")

template/client/store/example.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
let store = require('begin-build/store');
2+
3+
// Optional things to do in init
4+
let api = require('begin-build/api');
5+
let { ready } = require('begin-build/router');
6+
7+
/*
8+
* How to set up a store module:
9+
* - store() will namespace this Vuex store module by the name of the file
10+
* - keep module.id as the first argument to store()
11+
* - index.js inside subdirectories will become namespaced to the parent directory name
12+
* - if this is in a subdirectory of the store directory this will be a pathed submodule
13+
*/
14+
module.exports = store(module.id, {
15+
state: {
16+
example: false,
17+
},
18+
19+
mutations: {
20+
setExample(state, data) {
21+
state.example = data;
22+
},
23+
24+
toggleExample(state) {
25+
state.example = !state.example;
26+
},
27+
},
28+
29+
getters: {
30+
getExample(state) {
31+
return state.example;
32+
},
33+
},
34+
35+
actions: {
36+
// init is a special action that will be automatically executed when this store is initialized
37+
async init({ commit, getters }) {
38+
39+
// run some async function like a request using axios
40+
let { data } = await api.get('example/endpoint');
41+
42+
// commit mutations or dispatch actions
43+
commit('setExample', data);
44+
45+
// do things with router and the store
46+
let router = await ready;
47+
router.beforeEach((route, redirect, next) => {
48+
if (route.matched.some(record => record.meta.example)) {
49+
commit('setExample', true);
50+
51+
// view the store with getters
52+
} else if(getters.example) {
53+
commit('toggleExample');
54+
}
55+
next();
56+
});
57+
},
58+
},
59+
});

template/client/variables.sass

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$animate-speed: 0.4s
2+
$fast-animate-speed: 0.2s
3+
4+
// TODO: add your global Sass variables here
5+
6+
// Keep at bottom of file
7+
@import ~frow/variables

template/package.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Example",
3+
"main": "index.js",
4+
"version": "0.1.0",
5+
"engines": {
6+
"node": ">=8.9"
7+
},
8+
"description": "Example description",
9+
"homepage": "http://example.com",
10+
"repository": "Example/homepage",
11+
"bugs": {
12+
"url": "https://github.com/Example/homepage/issues"
13+
},
14+
"author": {
15+
"name": "Me",
16+
"email": "me@example.com",
17+
"url": "http://example.com"
18+
},
19+
"contributors": [
20+
"John Doe <john@example.com> (example.com)"
21+
],
22+
"license": "UNLICENSED",
23+
"private": true,
24+
"scripts": {
25+
"b": "CONTEXT=$(pwd) npm explore begin-build -- npm run",
26+
"start": "npm run b start:client"
27+
},
28+
"devDependencies": {
29+
"begin-util": "^1.0.0",
30+
"begin-build": "^0.8.0"
31+
},
32+
"// HACK: postcss-loader must have config": "",
33+
"postcss": {}
34+
}

template/properties.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"domain": "example.com",
3+
"base": {
4+
"client": {
5+
"title": "Fresh template | begin-build",
6+
"color": "#12D8B7"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)