diff --git a/components/BaseCheatsheet.vue b/components/BaseCheatsheet.vue index 2bd7d21..faea237 100644 --- a/components/BaseCheatsheet.vue +++ b/components/BaseCheatsheet.vue @@ -10,7 +10,7 @@ target="_blank" ) img( - :src="'/images/components/BaseCheatsheet/' + thumbnail" + :src="baseUrl + '/images/components/BaseCheatsheet/' + thumbnail" class="c-base-cheatsheet__thumbnail" ) @@ -53,6 +53,9 @@ export default { data() { return { + // --> STATE <-- + baseUrl: process.env.baseUrl, + // --> COMPONENTS <-- networks: ["Slack", "Messenger", "Telegram", "Twitter", "LinkedIn"] }; diff --git a/components/BaseShare.vue b/components/BaseShare.vue index 44024f4..9011cae 100644 --- a/components/BaseShare.vue +++ b/components/BaseShare.vue @@ -11,7 +11,7 @@ div( ) img( @click="onClick" - :src="'/images/components/BaseShare/' + network.toLowerCase() + '.svg'" + :src="baseUrl + '/images/components/BaseShare/' + network.toLowerCase() + '.svg'" class="c-base-share__image" ) @@ -29,6 +29,13 @@ export default { } }, + data() { + return { + // --> STATE <-- + baseUrl: process.env.baseUrl + }; + }, + methods: { onClick() { this.$emit("click", this.network); diff --git a/nuxt.config.js b/nuxt.config.js index 495b904..ab6de32 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -13,7 +13,14 @@ module.exports = { ], link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }] }, - loading: { color: "#3B8070" }, + env: { + baseUrl: + process.env.NODE_ENV === "production" + ? "https://lecoupa.github.io/awesome-cheatsheets/" + : "http://localhost:3000" + }, + css: ["normalize.css/normalize.css"], + plugins: [{ src: "@/plugins/global.js" }], build: { extend(config, { isDev, isClient }) { if (isDev && isClient) { @@ -26,7 +33,5 @@ module.exports = { } }, postcss: [require("autoprefixer")()] - }, - css: ["normalize.css/normalize.css"], - plugins: [{ src: "@/plugins/global.js" }] + } }; diff --git a/pages/index.vue b/pages/index.vue index 85b42e1..0123a4e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -10,8 +10,8 @@ target="_blank" ) img( - src="/images/common/logo.png" - srcset="/images/common/logo@2x.png" + :src="baseUrl + '/images/common/logo.png'" + :srcset="baseUrl + '/images/common/logo@2x.png'" class="c-index__logo" ) @@ -46,6 +46,9 @@ export default { data() { return { + // --> STATE <-- + baseUrl: process.env.baseUrl, + // --> COMPONENTS <-- categories: [ {