From 8e49f2b9423fe77c49635a839e77a265c8648149 Mon Sep 17 00:00:00 2001 From: Damillora Date: Mon, 6 Jan 2020 02:46:59 +0700 Subject: [PATCH] Make a proper library --- docs/.vuepress/config.js | 33 +++++++++++++------------------- docs/.vuepress/enhanceApp.js | 15 +++++++++++++++ docs/components/Header/README.md | 10 ++++++++++ docs/components/README.md | 1 + package.json | 2 +- src/components/index.js | 10 ++++++++++ src/main.js | 8 +------- yarn.lock | 2 +- 8 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 docs/.vuepress/enhanceApp.js create mode 100644 docs/components/Header/README.md create mode 100644 docs/components/README.md create mode 100644 src/components/index.js diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 543729f..ed2aacc 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,34 +1,27 @@ +const glob = require('glob'); const autoprefixer = require('autoprefixer'); const tailwindcss = require('tailwindcss'); -const postcssPurgecss = require(`@fullhuman/postcss-purgecss`); -const purgecss = postcssPurgecss({ - // Specify the paths to all of the template files in your project. - content: [ - './public/**/*.html', - './src/**/*.vue', - ], - // Include any special characters you're using in this regular expression. - // See: https://tailwindcss.com/docs/controlling-file-size/#understanding-the-regex - defaultExtractor: content => content.match(/[\w-/:]+(? f.replace("docs","").replace("README.md","")); +} +let links = function(path) { + return [ path+'/', ...paths(path+'/*') ] +} module.exports = { title: "Yuika documentation", description: "", themeConfig: { - sidebar: 'auto', + sidebar: [ + { title: 'Yuika', path: '/', }, + { title: 'Components', path: '/components/', children: links('/components') }, + ] }, postcss: { plugins: [ - require("autoprefixer"), - require("tailwindcss")("./tailwind.config.js"), - ...process.env.NODE_ENV === 'production' - ? [purgecss] - : [], + tailwindcss, + autoprefixer, ] } }; diff --git a/docs/.vuepress/enhanceApp.js b/docs/.vuepress/enhanceApp.js new file mode 100644 index 0000000..b9a38d4 --- /dev/null +++ b/docs/.vuepress/enhanceApp.js @@ -0,0 +1,15 @@ +import { Header, HeaderLeft, HeaderMiddle, HeaderRight } from '../../src/components'; +import '../../src/assets/css/tailwind.css'; + +export default ({ + Vue, // the version of Vue being used in the VuePress app + options, // the options for the root Vue instance + router, // the router instance for the app + siteData // site metadata +}) => { + Vue.component('Header', Header); + Vue.component('HeaderLeft', HeaderLeft); + Vue.component('HeaderMiddle', HeaderMiddle); + Vue.component('HeaderRight', HeaderRight); +} + diff --git a/docs/components/Header/README.md b/docs/components/Header/README.md new file mode 100644 index 0000000..12c1b7a --- /dev/null +++ b/docs/components/Header/README.md @@ -0,0 +1,10 @@ +# Header +
+ + + +

Yuika Mitsumine

+
+ + +
diff --git a/docs/components/README.md b/docs/components/README.md new file mode 100644 index 0000000..0eac4eb --- /dev/null +++ b/docs/components/README.md @@ -0,0 +1 @@ +# Components diff --git a/package.json b/package.json index 0282f20..76da4a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mitsuminedamillora/yuika", - "version": "0.1.1", + "version": "0.2.0", "main": "./dist/yuika.common.js", "license": "MIT", "scripts": { diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 0000000..6bd837e --- /dev/null +++ b/src/components/index.js @@ -0,0 +1,10 @@ +import { Header, HeaderLeft, HeaderMiddle, HeaderRight } from './Header'; +import { NavigationBar, NavigationItem } from './Navigation'; +export { + Header, + HeaderLeft, + HeaderMiddle, + HeaderRight, + NavigationBar, + NavigationItem, +} diff --git a/src/main.js b/src/main.js index 0e0aadf..e2d4b87 100644 --- a/src/main.js +++ b/src/main.js @@ -1,9 +1,3 @@ -import Vue from 'vue' -import App from './App.vue' -import '@/assets/css/tailwind.css'; -Vue.config.productionTip = false +export * from './components'; -new Vue({ - render: h => h(App), -}).$mount('#app') diff --git a/yarn.lock b/yarn.lock index 8d653fb..f592e56 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4063,7 +4063,7 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: +glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==