-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from IBEC-BOX/fix/config
Fix/config
- Loading branch information
Showing
2 changed files
with
108 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,128 @@ | ||
import {addComponent, addPlugin, createResolver, defineNuxtModule} from '@nuxt/kit' | ||
import { | ||
addComponent, | ||
addPlugin, | ||
createResolver, | ||
defineNuxtModule, | ||
} from "@nuxt/kit"; | ||
|
||
// Module options TypeScript interface definition | ||
export interface ModuleOptions {} | ||
export interface ModuleOptions { | ||
theme: string; | ||
components: string[]; | ||
} | ||
|
||
export default defineNuxtModule<ModuleOptions>({ | ||
meta: { | ||
name: 'nuxt3-ui-kit', | ||
configKey: 'nuxt3UIKit' | ||
name: "nuxt3-ui-kit", | ||
configKey: "nuxt3UIKit", | ||
}, | ||
// Default configuration options of the Nuxt module | ||
defaults: { | ||
theme: 'light' | ||
theme: "light", | ||
components: [] | ||
}, | ||
setup (options, nuxt) { | ||
const resolver = createResolver(import.meta.url) | ||
const runtimeDir = resolver.resolve('./runtime') | ||
setup(options, nuxt) { | ||
const resolver = createResolver(import.meta.url); | ||
const runtimeDir = resolver.resolve("./runtime"); | ||
|
||
const isDevelopment = runtimeDir.endsWith('src/runtime') || runtimeDir.endsWith('src\\runtime') | ||
const isDevelopment = | ||
runtimeDir.endsWith("src/runtime") || runtimeDir.endsWith("src\\runtime"); | ||
|
||
const extension = isDevelopment ? 'scss' : 'css' | ||
const extension = isDevelopment ? "scss" : "css"; | ||
|
||
// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack` | ||
addPlugin(resolver.resolve('./runtime/plugin')) | ||
addPlugin(resolver.resolve("./runtime/plugin")); | ||
|
||
nuxt.options.css.push(resolver.resolve(`./runtime/plugins/vuetify/styles.${extension}`)) | ||
nuxt.options.css.push( | ||
resolver.resolve(`./runtime/plugins/vuetify/styles.${extension}`) | ||
); | ||
|
||
// Components | ||
addComponent({ | ||
name: 'pagesTestVuetify', // name of the component to be used in vue templates | ||
filePath: resolver.resolve('runtime/components/Pages/TestVuetify.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsFooterDefault', // name of the component to be used in vue templates | ||
filePath: resolver.resolve('runtime/components/Parts/Footer/Default.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsCard', // name of the component to be used in vue templates | ||
filePath: resolver.resolve('runtime/components/Parts/Card.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsForms', // name of the component to be used in vue templates | ||
filePath: resolver.resolve('runtime/components/Parts/Forms.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsErgVacancies', // name of the component to be used in vue templates | ||
filePath: resolver.resolve('runtime/components/Parts/ErgVacancies.vue') | ||
}) | ||
|
||
// Header | ||
addComponent( { | ||
name: 'partsHeaderDefault', | ||
filePath: resolver.resolve('runtime/components/Parts/Header/Default.vue') | ||
}) | ||
if (options.components.includes("pagesTestVuetify")) { | ||
addComponent({ | ||
name: "pagesTestVuetify", // name of the component to be used in vue templates | ||
filePath: resolver.resolve("runtime/components/Pages/TestVuetify.vue"), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsFooterDefault")) { | ||
addComponent({ | ||
name: "partsFooterDefault", // name of the component to be used in vue templates | ||
filePath: resolver.resolve( | ||
"runtime/components/Parts/Footer/Default.vue" | ||
), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsCard")) { | ||
addComponent({ | ||
name: "partsCard", // name of the component to be used in vue templates | ||
filePath: resolver.resolve("runtime/components/Parts/Card.vue"), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsForms")) { | ||
addComponent({ | ||
name: "partsForms", // name of the component to be used in vue templates | ||
filePath: resolver.resolve("runtime/components/Parts/Forms.vue"), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsErgVacancies")) { | ||
addComponent({ | ||
name: "partsErgVacancies", // name of the component to be used in vue templates | ||
filePath: resolver.resolve("runtime/components/Parts/ErgVacancies.vue"), | ||
}); | ||
} | ||
|
||
addComponent( { | ||
name: 'partsHeaderErg', | ||
filePath: resolver.resolve('runtime/components/Parts/Header/Erg.vue') | ||
}) | ||
// Header | ||
if (options.components.includes("partsHeaderDefault")) { | ||
addComponent({ | ||
name: "partsHeaderDefault", | ||
filePath: resolver.resolve( | ||
"runtime/components/Parts/Header/Default.vue" | ||
), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsHeaderErg")) { | ||
addComponent({ | ||
name: "partsHeaderErg", | ||
filePath: resolver.resolve("runtime/components/Parts/Header/Erg.vue"), | ||
}); | ||
} | ||
|
||
// Modal | ||
addComponent( { | ||
name: 'partsModal', | ||
filePath: resolver.resolve('runtime/components/Parts/Modal.vue') | ||
}) | ||
if (options.components.includes("partsModal")) { | ||
addComponent({ | ||
name: "partsModal", | ||
filePath: resolver.resolve("runtime/components/Parts/Modal.vue"), | ||
}); | ||
} | ||
|
||
//Slider | ||
addComponent({ | ||
name: 'partsSlider', | ||
filePath: resolver.resolve('runtime/components/Parts/Slider.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsNews', | ||
filePath: resolver.resolve('runtime/components/Parts/News.vue') | ||
}) | ||
|
||
addComponent({ | ||
name: 'partsFilesDownloadFiles', | ||
filePath: resolver.resolve('runtime/components/Parts/Files/DownloadFiles.vue') | ||
}) | ||
} | ||
}) | ||
if (options.components.includes("partsSlider")) { | ||
addComponent({ | ||
name: "partsSlider", | ||
filePath: resolver.resolve("runtime/components/Parts/Slider.vue"), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsNews")) { | ||
addComponent({ | ||
name: "partsNews", | ||
filePath: resolver.resolve("runtime/components/Parts/News.vue"), | ||
}); | ||
} | ||
|
||
if (options.components.includes("partsFilesDownloadFiles")) { | ||
addComponent({ | ||
name: "partsFilesDownloadFiles", | ||
filePath: resolver.resolve( | ||
"runtime/components/Parts/Files/DownloadFiles.vue" | ||
), | ||
}); | ||
} | ||
}, | ||
}); |