Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julien local dev & summary option #23

Merged
merged 5 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Technologies used for **multi-site** are the followiing :
- [Dotenv](https://www.npmjs.com/package/dotenv) - js library to load env variables ;
- [Gray matter](https://www.npmjs.com/package/gray-matter) - js library to transform yaml or markdown data into js objects ;
- [vue-Showdown](https://vue-showdown.js.org/) - js plugin to transform markdown into html ;
- [highlight.js](https://highlightjs.org/) - to apply css to code blocks (nice colors for every languages) ;

---

Expand Down
5 changes: 4 additions & 1 deletion assets/custom-styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Import Bulma's core

@import "~bulma/sass/utilities/_all";

// Import Bulma's core
@import "~highlight.js/styles/default";

// h1 {
// font-size: 2em;
// font-weight: bold;
Expand Down
77 changes: 40 additions & 37 deletions components/contents/ContentsSkeleton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div class="mb-5 mt-3">
<div
class="content-skeleton mb-5 mt-3">

<!-- DEBUG -->
<div
Expand Down Expand Up @@ -31,47 +32,48 @@

<LogoAnimated
v-if="section.component === 'LogoAnimated' && sectionData"
:sectionIndex="sectionIndex"
:sectionData="sectionData"
:sectionOptions="sectionOptions"
:section-index="sectionIndex"
:section-data="sectionData"
:section-options="sectionOptions"
:debug="false"
/>

<TextComponent
v-if="section.component === 'TextComponent' && sectionData"
:sectionIndex="sectionIndex"
:sectionData="sectionData"
:sectionOptions="sectionOptions"
class="TextComponent"
:section-index="sectionIndex"
:section-data="sectionData"
:section-options="sectionOptions"
:debug="false"
/>

<DataGrid
v-if="section.component === 'DataGrid' && sectionData"
:sectionIndex="sectionIndex"
:sectionData="sectionData"
:sectionOptions="sectionOptions"
:section-index="sectionIndex"
:section-data="sectionData"
:section-options="sectionOptions"
:debug="false"
/>

<TextDataComponent
v-if="section.component === 'TextDataComponent' && sectionData"
:sectionIndex="sectionIndex"
:sectionData="sectionData"
:sectionOptions="sectionOptions"
:section-index="sectionIndex"
:section-data="sectionData"
:section-options="sectionOptions"
:debug="false"
/>

<ButtonsComponent
v-if="section.component === 'ButtonsComponent'"
:sectionIndex="sectionIndex"
:sectionOptions="sectionOptions"
:section-index="sectionIndex"
:section-options="sectionOptions"
:debug="false"
/>

<WidgetComponent
v-if="section.component === 'WidgetComponent'"
:sectionIndex="sectionIndex"
:sectionOptions="sectionOptions"
:section-index="sectionIndex"
:section-options="sectionOptions"
:debug="true"
/>

Expand All @@ -86,11 +88,6 @@ import { mapState, mapGetters } from 'vuex'

export default {
name: 'ContentsSkeleton',
props: [
'section',
'sectionIndex',
'debug'
],
components: {
LogoAnimated: () => import(/* webpackChunkName: "LogoAnimated" */ '~/components/contents/LogoAnimated.vue'),
TextComponent: () => import(/* webpackChunkName: "TextComponent" */ '~/components/contents/TextComponent.vue'),
Expand All @@ -99,20 +96,11 @@ export default {
ButtonsComponent: () => import(/* webpackChunkName: "ButtonsComponent" */ '~/components/buttons/ButtonsComponent.vue'),
WidgetComponent: () => import(/* webpackChunkName: "WidgetComponent" */ '~/components/advanced/WidgetComponent.vue'),
},
async mounted() {
// console.log('-C- ContentsSkeleton > mounted > this.section :', this.section)
if (this.section.files) {
await this.getFileData()
}
},
watch: {
async locale(next) {
// console.log('-C- ContentsSkeleton > watch > locale > next :', next)
if (this.section.files) {
await this.getFileData()
}
}
},
props: [
'section',
'sectionIndex',
'debug'
],
data() {
return {
sectionData: undefined,
Expand Down Expand Up @@ -144,11 +132,26 @@ export default {
return this.section.options
}
},
watch: {
async locale(next) {
// console.log('-C- ContentsSkeleton > watch > locale > next :', next)
if (this.section.files) {
await this.getFileData()
}
}
},
async mounted() {
// console.log('\n-C- ContentsSkeleton > mounted > this.section :', this.section)
if (this.section.files) {
await this.getFileData()
}
},
methods: {
async getFileData() {
const urlRaw = this.convertUrl
// console.log('-C- ContentsSkeleton > getFileData > urlRaw :', urlRaw)
// console.log('\n-C- ContentsSkeleton > getFileData > urlRaw :', urlRaw)
const req = await this.$axios.get(urlRaw)
// console.log('-C- ContentsSkeleton > getFileData > req.data :', req.data)
const fileData = matter(req.data)
this.sectionData = {
data: fileData.data,
Expand Down
2 changes: 2 additions & 0 deletions components/contents/TextComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
:markdown="content"
:flavor="showdownOptions.flavor"
:options="showdownOptions.options"
:extensions="showdownOptions.extensions"
/>

<!-- render columns with options -->
Expand All @@ -73,6 +74,7 @@
:markdown="splitContent"
:flavor="showdownOptions.flavor"
:options="showdownOptions.options"
:extensions="showdownOptions.extensions"
/>
</div>
</div>
Expand Down
16 changes: 0 additions & 16 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ export default {
FooterComponent: () => import(/* webpackChunkName: "FooterComponent" */ '~/components/footer/FooterComponent.vue'),
CreditsFooter: () => import(/* webpackChunkName: "CreditsFooter" */ '~/components/footer/CreditsFooter.vue'),
},
data() {
return {
// items: [
// {
// title: 'Home',
// icon: 'home',
// to: { name: 'index' },
// },
// {
// title: 'Inspire',
// icon: 'lightbulb',
// to: { name: 'inspire' },
// },
// ],
}
},
computed: {
...mapState({
log: (state) => state.log,
Expand Down
1 change: 0 additions & 1 deletion middleware/buildFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default async function ({
store.dispatch('updateFooter', footerObject)
})


}

}
18 changes: 9 additions & 9 deletions middleware/buildNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export default async function ({
// console.log( '-MW- buildNavbar > urlNavbarFile : ', urlNavbarFile )

await $axios.get(urlNavbarFile)
.then( resp => {
// convert string to json object
const navbarObject = matter(resp.data)
// console.log( '-MW- buildNavbar > navbarObject : ', navbarObject )
// save to store
store.dispatch('updateNavbar', navbarObject)
})
.then( resp => {
// convert string to json object
const navbarObject = matter(resp.data)
// console.log( '-MW- buildNavbar > navbarObject : ', navbarObject )

// save to store
store.dispatch('updateNavbar', navbarObject)
})

}

}
3 changes: 1 addition & 2 deletions middleware/buildRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export default async function ({
// save to store
store.dispatch('updateRoutes', routesObject)
})



}

}
9 changes: 6 additions & 3 deletions middleware/getConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

import matter from 'gray-matter'

import { extractGitInfos } from '~/utils/utilsGitUrl'
// import { GetFileObjectFromURL } from '~/utils/utilsFiles'

export default async function ({
store,
Expand All @@ -19,11 +21,12 @@ export default async function ({

// extract git infos
const gitInfos = extractGitInfos(urlConfigFile)
// console.log( '-MW- getConfig > gitInfos : \n', gitInfos )
store.dispatch('updateGitInfos', gitInfos)
// console.log( '-MW- getConfig > gitInfos : \n', gitInfos )

const urlConfigFileRaw = `${gitInfos.gitRawRoot}${gitInfos.remainingString}`

// console.log( '-MW- getConfig > urlConfigFileRaw : \n', urlConfigFileRaw )

await $axios.get(urlConfigFileRaw)
.then( resp => {

Expand All @@ -34,7 +37,7 @@ export default async function ({
// save to store
return store.dispatch('updateConfig', configObject)
})

}

}
13 changes: 7 additions & 6 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const dotenv = require('dotenv')

import axios from 'axios'
// import axios from 'axios'

import {
logAllowed,
configApp
ConfigApp
} from './utils/utilsConfig'

const dotenv = require('dotenv')

// loads .env file(s)
dotenv.config()
// dotenv.config({ path: 'production.env' })

const RUN_MODE = process.env.NUXT_ENV_RUN_MODE || process.env.NUXT_ENV_RUN_MODE_OVERIDE

const config = new configApp(RUN_MODE, process.env)
const config = new ConfigApp(RUN_MODE, process.env)
console.log('>>> nuxt.config.js (start) / config : ', config)


Expand Down Expand Up @@ -87,8 +87,9 @@ export default {
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
// 'bulma',
'@/assets/custom-styles.scss',
'@/assets/custom-styles.scss'
// '~/assets/custom-styles.scss',
// '~/highlight.js/scss/default.scss'
],

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
Expand Down
Loading