Skip to content

liyanlong/nuxt-egg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Egg-Nuxt

Egg + Nuxt.js = 🔥

NPM version build status Test coverage David deps npm download lincense image

Requirement

  • node >= 6.0.0

Quick Usage

$ npm install -g vue-cli
$ vue init nuxt-egg/starter my_project
or 
$ npm install -g egg-init
$ egg-init --package=egg-boilerplate-nuxt my_project

$ cd my_prject
$ npm install
$ npm run dev

Direct Structure

Look at egg-framework

nuxt-egg-project
├── .nuxt
├── resources
|   ├── pages
│   ├── assets
│   |   └── css
│   |   └── img
│   ├── static
│   ├── layouts
│   ├── middleware
│   ├── plugins
│   ├── components
├── package.json
├── app.js (option)
├── agent.js (option)
├── app
|   ├── router.js
│   ├── controller
│   |   └── home.js
│   ├── service (option)
│   |   └── user.js
│   ├── middleware (option)
│   |   └── response_time.js
│   ├── schedule (option)
│   |   └── my_task.js
│   ├── public (option)
│   |   └── reset.css
│   ├── view (option)
│   |   └── home.tpl
│   └── extend (option)
│       ├── helper.js (option)
│       ├── request.js (option)
│       ├── response.js (option)
│       ├── context.js (option)
│       ├── application.js (option)
│       └── agent.js (option)
├── config
|   ├── plugin.js
|   ├── config.default.js
│   ├── config.prod.js
|   ├── config.test.js (option)
|   ├── config.local.js (option)
|   └── config.unittest.js (option)
└── test
    ├── middleware
    |   └── response_time.test.js
    └── controller
        └── home.test.js

Nuxt.js Changes

  • The Nuxt config file is now in config.[dev].js, dev allow set default, unittest, local, prod
  • The Nuxt project directory is resources (default)

config.default.js

const path = require('path');
exports.nuxt = {
  srcDir: path.join(__dirname, '../resources'),
  rootDir: path.dirname(__dirname),
}

Or you can also do this

// config/config.default.js
exports.nuxt = require('./config.nuxt.js');

// config/config.nuxt.js
module.exports = {
  srcDir: ''
  rootDir: ''
}

Live Demo

Documentation

Licenses

Note

  • egg-init doesn't support download image now, so the logo.png will not be open normal.