build(nuxt): add settings to deploy to github pages

This commit is contained in:
Julien
2018-10-02 17:39:36 +01:00
parent d0eb50839c
commit 5ada8ed63e
3 changed files with 2417 additions and 2383 deletions

View File

@@ -1,3 +1,20 @@
/**************************************************************************
* ENVIRONMENT CONFIGURATIONS
***************************************************************************/
const router =
process.env.NODE_ENV === "production"
? {
router: {
base: "/dark-mode/"
}
}
: {};
/**************************************************************************
* EXPORT
***************************************************************************/
module.exports = { module.exports = {
head: { head: {
title: "Awesome Cheatsheets", title: "Awesome Cheatsheets",
@@ -13,14 +30,18 @@ module.exports = {
], ],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }] link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
}, },
env: { env: {
baseUrl: baseUrl:
process.env.NODE_ENV === "production" process.env.NODE_ENV === "production"
? "https://lecoupa.github.io/awesome-cheatsheets/" ? "https://lecoupa.github.io/awesome-cheatsheets/"
: "http://localhost:3000" : "http://localhost:3000"
}, },
css: ["normalize.css/normalize.css"], css: ["normalize.css/normalize.css"],
plugins: [{ src: "@/plugins/global.js" }], plugins: [{ src: "@/plugins/global.js" }],
modules: [ modules: [
[ [
"@nuxtjs/google-analytics", "@nuxtjs/google-analytics",
@@ -40,6 +61,7 @@ module.exports = {
] ]
] ]
], ],
build: { build: {
extend(config, { isDev, isClient }) { extend(config, { isDev, isClient }) {
if (isDev && isClient) { if (isDev && isClient) {
@@ -52,5 +74,7 @@ module.exports = {
} }
}, },
postcss: [require("autoprefixer")()] postcss: [require("autoprefixer")()]
} },
...router
}; };

4769
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,12 +6,12 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "nuxt", "dev": "nuxt",
"build": "nuxt build", "build": "NODE_ENV=production nuxt build",
"start": "nuxt start", "start": "nuxt start",
"generate": "NODE_ENV=production nuxt generate", "generate": "NODE_ENV=production nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .", "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint", "precommit": "npm run lint",
"deploy": "git subtree push --prefix dist origin gh-pages" "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup"
}, },
"dependencies": { "dependencies": {
"@nuxtjs/google-analytics": "^2.0.2", "@nuxtjs/google-analytics": "^2.0.2",
@@ -30,6 +30,7 @@
"nuxt-sass-resources-loader": "^2.0.5", "nuxt-sass-resources-loader": "^2.0.5",
"pug": "^2.0.3", "pug": "^2.0.3",
"pug-plain-loader": "^1.0.0", "pug-plain-loader": "^1.0.0",
"push-dir": "^0.4.1",
"sass-loader": "^7.1.0" "sass-loader": "^7.1.0"
} }
} }