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"
)
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"]
};

View File

@ -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"
)
</template>
@ -29,6 +29,13 @@ export default {
}
},
data() {
return {
// --> STATE <--
baseUrl: process.env.baseUrl
};
},
methods: {
onClick() {
this.$emit("click", this.network);

View File

@ -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" }]
}
};

View File

@ -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: [
{