There’re a few ways to use Vue Design System with your applications:
Get started by cloning the repo and installing dependencies:
git clone https://github.com/arielsalminen/vue-design-system.git cd vue-design-system npm install
Make sure that you also have the latest Node.js (at least 8.2.1) installed.
After installing dependencies, you can start up and serve the Vue App at http://localhost:8080, by running the below command. This will also start up and serve the living documentation at http://localhost:6060. These same instructions should work on both macOS and Windows.
Once you have the design system up and running the following resources should help you forward:
The recommended way is to keep Vue Design System separate from your existing applications and use the design system library as a private NPM dependency. What this basically means, is that your system’s base tokens, elements and patterns live in the system project and are only imported into your existing applications.
The benefit of this is that all your applications will have one centralized source of truth which is easier to scale and maintain. See instructions below on how to use Vue Design System through NPM.
Using Design System as an NPM ModuleThere are a few things that you need to do to accomplish this. While the package.json has been prepared for this kind of usage, you will have to rename the project before running the build script. Find the below line from package.json
to name your design system:
"name": "vue-design-system",
After you’ve renamed the project, you should be able to build your Design System for production in a way that allows the system to be published and used as an NPM module by running the following command:
This command will first re-create your tokens in json and scss formats and then build the design system library. Once done, you should see a list of assets created and their file sizes. With the default configuration this creates system.js
, system.css
and system.utils.scss
under dist/system
.
Once finished, you should be able to test locally that everything works by installing the system to another Vue project (you’ll need to change the path to match your own file system):
npm install --save file:/Users/arielle/code/vue-design-system
Once the design system module is installed successfully, you can import the system like this for example in your main.js
file (remember to replace “vue-design-system” with whatever name you used in your package.json):
import DesignSystem from 'vue-design-system' import 'vue-design-system/dist/system/system.css' Vue.use(DesignSystem)
All your components, patterns, and templates should now be automatically imported and available for usage the same way as they work inside the Design System.
To see a simplified demo project that does all this, see a repository I’ve created.
For more advanced needs, you can configure the way Webpack builds the library by editing build-system.js, webpack.system.conf.js and system config in config/index.js.
Build Design System’s playground for productionBuild Vue.js app (playground) for production with minification:
Build Vue.js app (playground) for production and view the bundle analyzer report:
npm run build:app --reportBuild Design System’s docs for production
Build docs for production:
Lint the code with ESLint:
Run unit tests with Jest:
All available build commandsnpm run build:system
builds the design system for NPMnpm run build:system --report
builds the design system for NPM and gives you bundle analyzer report.npm run build:docs
builds the design system docsnpm run build:app
builds the Vue appnpm run build:app --report
builds the Vue app and gives you bundle analyzer report.For more details on how Webpack works, check out the Webpack guide and docs for vue-loader.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4