An open API service indexing awesome lists of open source software.

https://github.com/markmead/alpinejs-money

Format money through Alpine JS into any language and currency (works with Shopify settings) 💸
https://github.com/markmead/alpinejs-money

alpine-js alpinejs alpinejs-plugin javascript money shopify

Last synced: over 1 year ago
JSON representation

Format money through Alpine JS into any language and currency (works with Shopify settings) 💸

Awesome Lists containing this project

README

          

# Alpine JS Money

Format money through Alpine JS into any language and currency 💸

## Install

### With a CDN

```html

```

### With a Package Manager

```shell
npm install -D alpinejs-money

yarn add -D alpinejs-money
```

```js
import Alpine from 'alpinejs'
import money from 'alpinejs-money'

Alpine.plugin(money)

Alpine.start()
```

## Example

### Basic

```html









```

### With Data Attributes

```html









```

### With Global

```html





```

This will look for `locale` and `currency` which is on the global `xMoney`
object.

```js
window.xMoney = {
locale: 'en-CA',
currency: 'CAD',
}
```

### With Shopify

```html





```

This will look for `Shopify.locale` and `Shopify.currency.active` which is on
the global `Shopify` object.

If this isn't set by default then you can set it like this.

```js
window.Shopify = {
locale: 'en-CA',
currency: {
active: 'CAD',
},
}
```

### Stats

![](https://img.shields.io/bundlephobia/min/alpinejs-money)
![](https://img.shields.io/npm/v/alpinejs-money)
![](https://img.shields.io/npm/dt/alpinejs-money)
![](https://img.shields.io/github/license/markmead/alpinejs-money)