Awesome
Using Vue Design System as an NPM Dependency on Nuxt project
Testing from a remote repository
- Clone this repository
- Run
rm -rf node_modules && npm install
- Now you can run
npm run dev
to test that the design system build and its components work.
- When you’re ready to start testing your own system library, switch the
vue-design-system
dependency in the package.json to point to your own private repository.
Testing things locally:
- Switch to your vueds project and change
libraryTarget
setting in config/index.js
to commonjs2
.
- Now build your design system for production by running
npm run build:system
inside the vueds project.
- After done, switch to this project and run first
rm -rf node_modules
to make sure the temporary local installation won’t cause issues.
- Now install the system locally by running
npm install --save file:/Users/viljamis/code/vue-design-system
(modify the path to match your own system).
- Once you’ve installed the design system, run
npm install
to install the rest of the dependencies.
- In your nuxt.js project, create a new file at
plugins/design-system.js
:
import Vue from 'vue'
import DesignSystem from 'vue-design-system'
import 'vue-design-system/dist/system/system.css'
Vue.use(DesignSystem)
- Import this plugin in the nuxt.config.js file (you can remove the
ssr: false
part if you build your library as a commonjs2
module):
plugins: [{
src: '~/plugins/design-system', ssr: false
}]
- Now you can run
npm run dev
to test that your design system build and its components work (you will get a couple of errors for some reason when testing locally).
- If everything more or less works you should move your system to a private GitHub repository and do the NPM install directly from that repo (see the steps above).