Margarita
Margarita is the UI Library from Holaluz.
Check out component examples.
WARNING: While Margarita is open source, its purpose is to improve code quality, consistency, and cross-team collaboration at Holaluz. Thus, it’s likely that we will introduce breaking API changes more often than usual.
About Margarita
Docs
You can find the docs here
Recommended IDE Setup
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
Type Support for .vue
Imports in TS
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and select Disable (Workspace)
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
Installing Margarita in another project
The NPM package is available here.
You can install Margarita as a dependency by running the following command in your Vue project:
$ npm install @holaluz/margarita
And then, use it as a plugin:
import Vue from 'vue'
import Margarita from '@holaluz/margarita'
Vue.use(Margarita)
For performance reasons, it's recommended (but not required) to preconnect to assets.holaluz.com
. To do so, add this code in the <head>
of your HTML:
<link rel="preconnect" href="https://assets.holaluz.com" />
Installing in Nuxt
First, create a plugin for Margarita:
import Vue from 'vue'
import Margarita from '@holaluz/margarita'
import '@holaluz/margarita/dist/margarita.css'
Vue.use(Margarita)
Finally, register it on the Nuxt config file, as any other Nuxt plugin:
export default {
plugins: ['./plugins/margarita.js']
}
For performance reasons, it's recommended (but not required) to preconnect to assets.holaluz.com
. To do so, add this code in head.link
of your nuxt.config
:
head: {
link: [
{
rel: 'preconnect',
href: 'https://assets.holaluz.com'
}
]
}
Installing Margarita locally
Clone the repo and install node dependencies:
$ npm install
Then you can run several commands such as
$ npm start
$ npm test
$ npm run test:watch
Deployment and versioning
Margarita uses Semantic Release to handle the release pipeline.
Triggering a new release will create the associated Git tag, the GitHub release entry, and publish a new version on npm.
In order to trigger a new version, make sure you add the appropriate prefix and message to the squashed commit. It is based on the Angular Commit Message Conventions. In short:
> fix: commit message
> feat: commit message
> fix: commit message
>
> BREAKING CHANGE: explain the breaking change
There's no need to overcomplicate things here. Keep it simple: fix
, feat
, and chore
(plus BREAKING CHANGE
) should be enough for now.
FAQ
How can I use Margarita as a dependency in a local project?
More often than not we'd want to work on a consumer while tweaking Magarita.
The best way to do so is by installing Margarita as a local dependency. Check out the instructions in Local Installation.
How can I contribute to documentation?
Follow the edition guidelines here