Skip to content

Commit

Permalink
refactor template (#176)
Browse files Browse the repository at this point in the history
* refactor template

* chore: add generate command
  • Loading branch information
farnabaz authored Jul 16, 2020
1 parent bd447ab commit cf8b857
Show file tree
Hide file tree
Showing 27 changed files with 548 additions and 205 deletions.
13 changes: 13 additions & 0 deletions template/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
14 changes: 8 additions & 6 deletions template/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
module.exports = {
root: true,
parser: 'babel-eslint',
env: {
browser: true,
node: true
},
extends: 'standard',
// required to lint *.vue files
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended'
],
plugins: [
'html'
],
// add your custom rules here
rules: {},
globals: {}
rules: {}
}
90 changes: 83 additions & 7 deletions template/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,90 @@
# dependencies
node_modules
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# logs
npm-debug.log
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Nuxt build
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# Backpack build
build
# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE / Editor
.idea

# Service worker
sw.*

# macOS
.DS_Store

# Vim swap files
*.swp
18 changes: 10 additions & 8 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# {{ name }}

> {{ description }}
# nuxt-express

## Build Setup

``` bash
```bash
# install dependencies
$ npm install # Or yarn install
$ yarn install

# serve with hot reload at localhost:3000
$ npm run dev
$ yarn dev

# build for production and launch server
$ npm start
$ yarn build
$ yarn start

# generate static project
$ yarn generate
```

For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js).
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).
15 changes: 11 additions & 4 deletions template/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ const app = express()

// Require API routes
const users = require('./routes/users')
const test = require('./routes/test')

// Import API Routes
app.use(users)
app.use(test)

// Export the server middleware
module.exports = {
path: '/api',
handler: app
// Export express app
module.exports = app

// Start standalone server if directly running
if (require.main === module) {
const port = process.env.PORT || 3001
app.listen(port, () => {
console.log(`API server listening on port ${port}`)
})
}
10 changes: 10 additions & 0 deletions template/api/routes/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { Router } = require('express')

const router = Router()

// Test route
router.use('/test', (req, res) => {
res.end('Test API!')
})

module.exports = router
7 changes: 7 additions & 0 deletions template/assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ASSETS

**This directory is not required, you can delete it if you don't want to use it.**

This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.

More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
28 changes: 0 additions & 28 deletions template/assets/css/main.css

This file was deleted.

Binary file removed template/assets/img/logo.png
Binary file not shown.
5 changes: 0 additions & 5 deletions template/components/Footer.vue

This file was deleted.

31 changes: 31 additions & 0 deletions template/components/Logo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{{{raw}}}}
<template>
<svg class="NuxtLogo" width="245" height="180" viewBox="0 0 452 342" xmlns="http://www.w3.org/2000/svg">
<path
d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z"
fill="#00C58E"
/>
<path
d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z"
fill="#108775"
/>
<path
d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z"
fill="#2F495E"
/>
</svg>
</template>
{{{{/raw}}}}

<style>
.NuxtLogo {
animation: 1s appear;
margin: auto;
}
@keyframes appear {
0% {
opacity: 0;
}
}
</style>
7 changes: 7 additions & 0 deletions template/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# COMPONENTS

**This directory is not required, you can delete it if you don't want to use it.**

The components directory contains your Vue.js Components.

_Nuxt.js doesn't supercharge these components._
7 changes: 7 additions & 0 deletions template/layouts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# LAYOUTS

**This directory is not required, you can delete it if you don't want to use it.**

This directory contains your Application Layouts.

More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
79 changes: 46 additions & 33 deletions template/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,52 +1,65 @@
{{{{raw}}}}
<template>
<div>
<nuxt/>
<my-footer/>
<Nuxt />
</div>
</template>
{{{{/raw}}}}

<script>
import MyFooter from '~/components/Footer.vue'
export default {
components: {
MyFooter
}
<style>
html {
font-family:
'Source Sans Pro',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
'Helvetica Neue',
Arial,
sans-serif;
font-size: 16px;
word-spacing: 1px;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
}
</script>
<style>
.container
{
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
width: 100%;
padding: 100px 0;
text-align: center;
}
.button, .button:visited
{
.button--green {
display: inline-block;
color: black;
letter-spacing: 1px;
background-color: #fff;
border: 2px solid #000;
border-radius: 4px;
border: 1px solid #3b8070;
color: #3b8070;
text-decoration: none;
text-transform: uppercase;
padding: 15px 45px;
padding: 10px 30px;
}
.button:hover, .button:focus
{
.button--green:hover {
color: #fff;
background-color: #000;
background-color: #3b8070;
}
.title
{
color: #000;
font-weight: 300;
font-size: 2.5em;
margin: 0;
.button--grey {
display: inline-block;
border-radius: 4px;
border: 1px solid #35495e;
color: #35495e;
text-decoration: none;
padding: 10px 30px;
margin-left: 15px;
}
.button--grey:hover {
color: #fff;
background-color: #35495e;
}
</style>
Loading

0 comments on commit cf8b857

Please sign in to comment.