node >= 6.0.0
$ 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
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
- The Nuxt config file is now in
config.[dev].js
,dev
allow setdefault
,unittest
,local
,prod
- The Nuxt project directory is
resources
(default)
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: ''
}
- egg-init doesn't support download image now, so the logo.png will not be open normal.