Giter VIP home page Giter VIP logo

vue-styleguide-generator's Introduction

Vue js components styleguide generator ๐Ÿ“š

Initially started after reading this vue.js feature request. Now only basic proof of concept is available which can load folder with .vue files, parse it and extract basic props of it.

Target is to have some tool with at least some of the React version capabilities.

Idea is to have what vue-play does but in automated way - with one task run, plus READMEs, etc.

Generate single html file containing all components listed with details and search out from your .vue project files.

1. Examples

Running on large components collections

Output UI demo

resulting output

2. Setup

  1. npm install vue-styleguide-generator --save-dev

  2. add to you package.json in script section - for example like this "build-components": "node ./node_modules/vue-styleguide-generator/" and then run npm run build-components from the root folder of the project.

๐Ÿƒ You can also manually (or using Gulp/Grunt) run node ./node_modules/vue-styleguide-generator/

3. Usage

โœ… Works only for Vue 2.x projects.

CLI options

Name Type Default Description
--src String Source dir, will be recursively scanned src
--dest String Destination output dir, file index.html will be placed there components-preview
--exclude RegExp File mask to exclude certain type of files /^./
--locale String Output locale language en
--verbose String Output all details while processing false
--all String Do not ignore any components false

E.g.: node ./node_modules/vue-styleguide-generator/ --src components --dest preview will read components from PROJECT_ROOT/components folder and provide a html page into PROJECT_ROOT/preview folder

To see all parser error run with DEBUG: DEBUG=app node ./node_modules/vue-styleguide-generator/

How the components are iterated

If you want to see more information about the component - add a .md file in the same directory. While retrieving the files the following assumptions are made:

  • if there are files with the same name in one folder (e.g. /scr/partials/TabBar.vue and /scr/partials/TabBar.md) it's assumed to be one component;
  • if there are only two files in the folder and one is .vue and another is .md (e.g. /scr/TabBar/codez.vue and /scr/partials/readers.md) it's assumed to be one component;
  • If there are >1 .vue files in the folder and .md file that does not have the same name as one of the .vue files - this .md file is ignored
  • Components with no props, no computed and no methods defined are considered to be a simple wrappers and not outputed

Found a bug or have a proposal - please create an issue or tweet me @legkoletat!

Todos

  • syntax highlighting
  • core: add tests
  • align parsing and display with vue-js-component-style-guide
  • core: move the demo-page to use Vue so that components can be generated from its declaration
  • ui: output extra component parameters (computable, data)
  • various use cases testing, added vuikit and Keen-UI links

Contributions are welcome ๐Ÿ‘!

Especially on following:

Bugs and problems

  • window object may not be patched fully so some component's code execution may fail
  • 'vue-template-compiler' must be the same as the version of 'vue' you're using in your codebase. Now set to 2.1.10. may have to manually put to other version that's used in your project.

vue-styleguide-generator's People

Contributors

shershen08 avatar

Watchers

Kate Dvoriankina avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.