1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-09-28 04:59:02 +00:00

build(app): use the right base url depending on environment

This commit is contained in:
Julien 2018-09-09 23:57:04 +02:00
parent c33bc70659
commit 5b53698c4d
4 changed files with 26 additions and 8 deletions

View File

@ -10,7 +10,7 @@
target="_blank" target="_blank"
) )
img( img(
:src="'/images/components/BaseCheatsheet/' + thumbnail" :src="baseUrl + '/images/components/BaseCheatsheet/' + thumbnail"
class="c-base-cheatsheet__thumbnail" class="c-base-cheatsheet__thumbnail"
) )
@ -53,6 +53,9 @@ export default {
data() { data() {
return { return {
// --> STATE <--
baseUrl: process.env.baseUrl,
// --> COMPONENTS <-- // --> COMPONENTS <--
networks: ["Slack", "Messenger", "Telegram", "Twitter", "LinkedIn"] networks: ["Slack", "Messenger", "Telegram", "Twitter", "LinkedIn"]
}; };

View File

@ -11,7 +11,7 @@ div(
) )
img( img(
@click="onClick" @click="onClick"
:src="'/images/components/BaseShare/' + network.toLowerCase() + '.svg'" :src="baseUrl + '/images/components/BaseShare/' + network.toLowerCase() + '.svg'"
class="c-base-share__image" class="c-base-share__image"
) )
</template> </template>
@ -29,6 +29,13 @@ export default {
} }
}, },
data() {
return {
// --> STATE <--
baseUrl: process.env.baseUrl
};
},
methods: { methods: {
onClick() { onClick() {
this.$emit("click", this.network); this.$emit("click", this.network);

View File

@ -13,7 +13,14 @@ module.exports = {
], ],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }] 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: { build: {
extend(config, { isDev, isClient }) { extend(config, { isDev, isClient }) {
if (isDev && isClient) { if (isDev && isClient) {
@ -26,7 +33,5 @@ module.exports = {
} }
}, },
postcss: [require("autoprefixer")()] postcss: [require("autoprefixer")()]
}, }
css: ["normalize.css/normalize.css"],
plugins: [{ src: "@/plugins/global.js" }]
}; };

View File

@ -10,8 +10,8 @@
target="_blank" target="_blank"
) )
img( img(
src="/images/common/logo.png" :src="baseUrl + '/images/common/logo.png'"
srcset="/images/common/logo@2x.png" :srcset="baseUrl + '/images/common/logo@2x.png'"
class="c-index__logo" class="c-index__logo"
) )
@ -46,6 +46,9 @@
export default { export default {
data() { data() {
return { return {
// --> STATE <--
baseUrl: process.env.baseUrl,
// --> COMPONENTS <-- // --> COMPONENTS <--
categories: [ categories: [
{ {