Skip to content

Commit

Permalink
add nuxt framework
Browse files Browse the repository at this point in the history
  • Loading branch information
thondery committed Feb 4, 2019
1 parent 5a47bd9 commit 4741246
Show file tree
Hide file tree
Showing 15 changed files with 14,532 additions and 104 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ typings/
# dotenv environment variables file
.env

# next.js build output
.next
# nuxt.js build output
.nuxt
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

all: install

clear:
@rm -rf .nuxt
@rm -rf build
@rm -rf node_modules

install:
@npm set registry https://registry.npm.taobao.org
@npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass
@npm install

update:
@npm set registry https://registry.npm.taobao.org
@npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass
@npm update
Empty file added assets/scss/common.scss
Empty file.
5 changes: 5 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<nuxt />
</div>
</template>
30 changes: 30 additions & 0 deletions modules/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export default function () {
// Add .ts extension for store, middleware and more
this.nuxt.options.extensions.push('ts')
// Extend build
this.extendBuild((config) => {
const tsLoader = {
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/]
},
exclude: [
/dist/,
/\.temp/
]
}
// Add TypeScript loader
config.module.rules.push(
Object.assign(
{
test: /((client|server)\.js)|(\.tsx?)$/
},
tsLoader
)
)
// Add .ts extension in webpack resolve
if (config.resolve.extensions.indexOf('.ts') === -1) {
config.resolve.extensions.push('.ts')
}
})
}
18 changes: 18 additions & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
head: {
title: '后台管理',
meta: [
{ charset: 'uft-8' },
{ 'http-equiv': 'X-UA-Compatible', content: 'IE=Edge' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
modules: [
'~/modules/typescript'
],
css: [
'~/assets/scss/common.scss'
]
}
Loading

0 comments on commit 4741246

Please sign in to comment.