Skip to content

Commit

Permalink
Added npm usage and updated CDN version
Browse files Browse the repository at this point in the history
  • Loading branch information
halfmoonui authored Jul 18, 2020
1 parent 7f6c79a commit 894a108
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,39 @@ The quickest way to get started with Halfmoon is by using the CDN to include the

```html
<!-- Halfmoon CSS -->
<link href="https://cdn.jsdelivr.net/gh/halfmoonui/[email protected].2/css/halfmoon.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/gh/halfmoonui/[email protected].3/css/halfmoon.min.css" rel="stylesheet" />

<!-- Halfmoon JS -->
<script src="https://cdn.jsdelivr.net/gh/halfmoonui/[email protected].2/js/halfmoon.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/halfmoonui/[email protected].3/js/halfmoon.min.js"></script>
```

## Using npm

```
npm install halfmoon
```

After installation, the required CSS and JS file can be imported in the following way:

```javascript
// Include CSS file
require("halfmoon/css/halfmoon.min.css");

// Import JS library
var halfmoon = require("halfmoon");
```

Please note that this method requires manual initialization, that is, after the DOM is loaded, the following method needs to be called:

```javascript
// Call this method after the DOM has been loaded
halfmoon.onDOMContentLoaded();
```

This initializes all of the components that require JavaScript, such as dropdowns,, custom file inputs, shortcuts, etc.

In this way, Halfmoon can be used with frameworks that use the virtual DOM, such as React and Vue. For instance, in the case of Vue, the `halfmoon.onDOMContentLoaded()` method would be called inside the `mounted()` hook of your component.

## Starter template generator

You can use the [starter template generator](https://www.gethalfmoon.com/docs/page-building/#starter-template-generator) to generate boilerplates for your project. The generator takes your settings and adds the appropriate classes and defines the required containers and elements.
Expand Down

0 comments on commit 894a108

Please sign in to comment.