From b3e909a704215bd67ffc681cb7fe50a7a88f8a86 Mon Sep 17 00:00:00 2001 From: Charlie Hield Date: Fri, 24 Feb 2017 21:37:05 -0600 Subject: [PATCH 1/6] Add Firebase example --- examples/with-firebase/.gitignore | 2 + examples/with-firebase/README.md | 31 ++++++++++++++++ examples/with-firebase/layouts/default.vue | 27 ++++++++++++++ examples/with-firebase/nuxt.config.js | 14 +++++++ examples/with-firebase/package.json | 20 ++++++++++ examples/with-firebase/pages/index.vue | 41 +++++++++++++++++++++ examples/with-firebase/pages/users/_key.vue | 25 +++++++++++++ examples/with-firebase/plugins/axios.js | 5 +++ 8 files changed, 165 insertions(+) create mode 100644 examples/with-firebase/.gitignore create mode 100644 examples/with-firebase/README.md create mode 100644 examples/with-firebase/layouts/default.vue create mode 100644 examples/with-firebase/nuxt.config.js create mode 100644 examples/with-firebase/package.json create mode 100644 examples/with-firebase/pages/index.vue create mode 100644 examples/with-firebase/pages/users/_key.vue create mode 100644 examples/with-firebase/plugins/axios.js diff --git a/examples/with-firebase/.gitignore b/examples/with-firebase/.gitignore new file mode 100644 index 0000000000..a77c238f1c --- /dev/null +++ b/examples/with-firebase/.gitignore @@ -0,0 +1,2 @@ +node_modules +.nuxt diff --git a/examples/with-firebase/README.md b/examples/with-firebase/README.md new file mode 100644 index 0000000000..93e0ad028a --- /dev/null +++ b/examples/with-firebase/README.md @@ -0,0 +1,31 @@ +# nuxt-firebase + +> Nuxt.js with Firebase (REST API) + +[DEMO](https://nuxt-firebase.now.sh/) + +## About + +This project uses [Firebase](https://firebase.google.com/). The tools and infrastructure you need to build better apps and grow successful businesses. + +You can view the Firebase data at [https://nuxt-firebase.firebaseio.com/.json](https://nuxt-firebase.firebaseio.com/.json). This is what the App will consume. + +## Getting Started + +Download this example [or clone the repo](https://github.com/nuxt/nuxt.js): + +```bash +curl https://codeload.github.com/nuxt/nuxt.js/tar.gz/master | tar -xz --strip=2 nuxt.js-master/examples/with-firebase +cd with-firebase +``` + +Install and run: + +```bash +npm install +npm run dev + +# or with Yarn +yarn +yarn dev +``` diff --git a/examples/with-firebase/layouts/default.vue b/examples/with-firebase/layouts/default.vue new file mode 100644 index 0000000000..e7f6311105 --- /dev/null +++ b/examples/with-firebase/layouts/default.vue @@ -0,0 +1,27 @@ + + + diff --git a/examples/with-firebase/nuxt.config.js b/examples/with-firebase/nuxt.config.js new file mode 100644 index 0000000000..1c42c25517 --- /dev/null +++ b/examples/with-firebase/nuxt.config.js @@ -0,0 +1,14 @@ +module.exports = { + head: { + meta: [ + { charset: 'utf-8' }, + { name: 'viewport', content: 'width=device-width, initial-scale=1' } + ], + link: [ + { rel: 'stylesheet', href: 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' } + ] + }, + build: { + vendor: ['axios'] + } +} diff --git a/examples/with-firebase/package.json b/examples/with-firebase/package.json new file mode 100644 index 0000000000..6f1b1f08d4 --- /dev/null +++ b/examples/with-firebase/package.json @@ -0,0 +1,20 @@ +{ + "name": "nuxt-firebase", + "version": "1.0.0", + "description": "Nuxt.js with Firebase", + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start" + }, + "keywords": [ + "nuxt", + "firebase" + ], + "author": "Charlie Hield", + "license": "MIT", + "dependencies": { + "axios": "^0.15.3", + "nuxt": "^0.9.9" + } +} diff --git a/examples/with-firebase/pages/index.vue b/examples/with-firebase/pages/index.vue new file mode 100644 index 0000000000..87fbc6bbee --- /dev/null +++ b/examples/with-firebase/pages/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/examples/with-firebase/pages/users/_key.vue b/examples/with-firebase/pages/users/_key.vue new file mode 100644 index 0000000000..94a2735870 --- /dev/null +++ b/examples/with-firebase/pages/users/_key.vue @@ -0,0 +1,25 @@ + + + diff --git a/examples/with-firebase/plugins/axios.js b/examples/with-firebase/plugins/axios.js new file mode 100644 index 0000000000..9e99293f71 --- /dev/null +++ b/examples/with-firebase/plugins/axios.js @@ -0,0 +1,5 @@ +import axios from 'axios' + +export default axios.create({ + baseURL: 'https://nuxt-firebase.firebaseio.com' +}) From b36162df73a04587977ce1120af506d17a708fa1 Mon Sep 17 00:00:00 2001 From: Limichange Date: Sun, 5 Mar 2017 22:44:01 +0800 Subject: [PATCH 2/6] Ignore all log files. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e8acaff17d..306525d111 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ yarn.lock node_modules # logs -npm-debug.log +*.log # other .nuxt From 18ec7507ad1c578e89eb028fb232b1a5173b7c71 Mon Sep 17 00:00:00 2001 From: bratberg Date: Tue, 14 Mar 2017 21:13:39 +0100 Subject: [PATCH 3/6] Add Vuetify.js example --- examples/with-vuetify/README.md | 4 ++++ examples/with-vuetify/nuxt.config.js | 7 +++++++ examples/with-vuetify/package.json | 12 ++++++++++++ examples/with-vuetify/pages/index.vue | 20 ++++++++++++++++++++ examples/with-vuetify/plugins/vuetify.js | 4 ++++ 5 files changed, 47 insertions(+) create mode 100644 examples/with-vuetify/README.md create mode 100644 examples/with-vuetify/nuxt.config.js create mode 100644 examples/with-vuetify/package.json create mode 100644 examples/with-vuetify/pages/index.vue create mode 100644 examples/with-vuetify/plugins/vuetify.js diff --git a/examples/with-vuetify/README.md b/examples/with-vuetify/README.md new file mode 100644 index 0000000000..4873ceb77b --- /dev/null +++ b/examples/with-vuetify/README.md @@ -0,0 +1,4 @@ +# Using Vuetify.js with Nuxt.js + +https://nuxtjs.org/examples/with-vuetify +https://vuetifyjs.com/ diff --git a/examples/with-vuetify/nuxt.config.js b/examples/with-vuetify/nuxt.config.js new file mode 100644 index 0000000000..bd26adf454 --- /dev/null +++ b/examples/with-vuetify/nuxt.config.js @@ -0,0 +1,7 @@ +module.exports = { + build: { + vendor: ['vuetify'] + }, + plugins: ['~plugins/vuetify.js'], + css: ['vuetify/dist/vuetify.min.css'] +} diff --git a/examples/with-vuetify/package.json b/examples/with-vuetify/package.json new file mode 100644 index 0000000000..0ee9083525 --- /dev/null +++ b/examples/with-vuetify/package.json @@ -0,0 +1,12 @@ +{ + "name": "with-vuetify", + "dependencies": { + "nuxt": "latest", + "vuetify": "^0.9.1" + }, + "scripts": { + "dev": "nuxt", + "build": "nuxt build", + "start": "nuxt start" + } +} diff --git a/examples/with-vuetify/pages/index.vue b/examples/with-vuetify/pages/index.vue new file mode 100644 index 0000000000..7418deaf5e --- /dev/null +++ b/examples/with-vuetify/pages/index.vue @@ -0,0 +1,20 @@ + + + diff --git a/examples/with-vuetify/plugins/vuetify.js b/examples/with-vuetify/plugins/vuetify.js new file mode 100644 index 0000000000..a91ae689bb --- /dev/null +++ b/examples/with-vuetify/plugins/vuetify.js @@ -0,0 +1,4 @@ +import Vue from 'vue' +import Vuetify from 'vuetify' + +Vue.use(Vuetify) From 1ef13c753558ea07770fecd514dceabcc54919d2 Mon Sep 17 00:00:00 2001 From: Espen Bratberg Date: Wed, 15 Mar 2017 13:01:52 +0100 Subject: [PATCH 4/6] Add sidebar to example --- examples/with-vuetify/layouts/default.vue | 6 ++++++ examples/with-vuetify/pages/index.vue | 26 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 examples/with-vuetify/layouts/default.vue diff --git a/examples/with-vuetify/layouts/default.vue b/examples/with-vuetify/layouts/default.vue new file mode 100644 index 0000000000..3f33e63651 --- /dev/null +++ b/examples/with-vuetify/layouts/default.vue @@ -0,0 +1,6 @@ + diff --git a/examples/with-vuetify/pages/index.vue b/examples/with-vuetify/pages/index.vue index 7418deaf5e..5aeb83257a 100644 --- a/examples/with-vuetify/pages/index.vue +++ b/examples/with-vuetify/pages/index.vue @@ -1,9 +1,19 @@ + + From c3bcd0529566dca3b6e05671a4d96368930d5317 Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Wed, 15 Mar 2017 15:01:44 +0100 Subject: [PATCH 5/6] Add config file option - Add optional --config-file and -c argv parameters - Display log message if file isn't found Issue: #391 --- bin/nuxt-build | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index 445480b6a2..a1529fa933 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -15,13 +15,29 @@ if (process.argv.indexOf('--analyze') !== -1 || process.argv.indexOf('-a') !== - process.argv = without(process.argv, '--analyze', '-a') } +var nuxtConfigFileName = 'nuxt.config.js' +var indexOfConfig = false +if (process.argv.indexOf('--config-file') !== -1) { + indexOfConfig = process.argv.indexOf('--config-file') +} else if (process.argv.indexOf('-c') !== -1) { + indexOfConfig = process.argv.indexOf('-c') +} + +if (indexOfConfig !== false) { + nuxtConfigFileName = process.argv.slice(indexOfConfig)[1] + process.argv = without(process.argv, '--config-file', '-c', nuxtConfigFileName) +} + var rootDir = resolve(process.argv.slice(2)[0] || '.') -var nuxtConfigFile = resolve(rootDir, 'nuxt.config.js') +var nuxtConfigFilePath = resolve(rootDir, nuxtConfigFileName) var options = {} -if (fs.existsSync(nuxtConfigFile)) { - options = require(nuxtConfigFile) +if (fs.existsSync(nuxtConfigFilePath)) { + options = require(nuxtConfigFilePath) +} else { + console.log(`Could not locate ${nuxtConfigFilePath}`) // eslint-disable-line no-console } + if (typeof options.rootDir !== 'string') { options.rootDir = rootDir } From fbd1c609fd3dfe51f564bd380d813b7c6192a6e0 Mon Sep 17 00:00:00 2001 From: Pierre RAMBAUD Date: Wed, 15 Mar 2017 15:14:16 +0100 Subject: [PATCH 6/6] Add missing comments --- bin/nuxt-build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/nuxt-build b/bin/nuxt-build index a1529fa933..50dbc246b8 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -16,6 +16,8 @@ if (process.argv.indexOf('--analyze') !== -1 || process.argv.indexOf('-a') !== - } var nuxtConfigFileName = 'nuxt.config.js' + +// --config-file option var indexOfConfig = false if (process.argv.indexOf('--config-file') !== -1) { indexOfConfig = process.argv.indexOf('--config-file') @@ -28,6 +30,7 @@ if (indexOfConfig !== false) { process.argv = without(process.argv, '--config-file', '-c', nuxtConfigFileName) } +// Root directory parameter var rootDir = resolve(process.argv.slice(2)[0] || '.') var nuxtConfigFilePath = resolve(rootDir, nuxtConfigFileName)