0.9.1 • Published 4 years ago

@tryghost/members-js v0.9.1

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

Members.js

CI Status npm version

Drop-in script to make the bulk of Ghost membership features work on any theme.

Usage

Add below script in your theme's default.hbs just before the end of body tag OR in the code injection footer in Ghost Admin.

<script defer src="https://unpkg.com/@tryghost/members-js@latest/umd/members.min.js" data-ghost="https://mymemberssite.com"></script>

The data-ghost attribute expects the URL for your site which is the only input Portal needs to work with your site's membership data via Ghost APIs.

NOTE: This is currently under active development and available only behind developer experiments flag - enableDeveloperExperiments in Ghost, which needs to be added to config file before starting the server.

Custom trigger button

By default, the script adds a default floating trigger button on the bottom right of your page which is used to trigger the popup on screen.

Its possible to override the default trigger button with your own by adding data attribute data-portal to any HTML tag on page, which will hide the default trigger and allow controlling the popup state by clicking on this element.

The script also adds custom class names to this element for open and close state of popup - gh-members-popup-open and gh-members-popup-close, allowing devs to update its UI based on popup state.

Basic Setup

  1. Clone this repository:
git@github.com:TryGhost/members.js.git
  1. Change into the new directory and install the dependencies:
cd members.js
yarn

Configure for local development

Only useful for active UI development without publishing a version on unpkg. Always use the unpkg link for testing latest released members.js.

In this repo(Members.js):

  • Run yarn build to create the minified bundle with your changes at umd/members.min.js

In your theme(Ex. Lyra):

  • Copy members.min.js from above and paste it in your theme at assets/built/members.min.js
  • Add below code in your theme's default.hbs just before end of body tag
<script src="{{asset "built/members.min.js"}}"></script>

Available Scripts

In the project directory, you can also run:

yarn start

Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits. You will also see any lint errors in the console.

yarn build

Creates the production single minified bundle for external use in umd/members.min.js.

yarn test

Launches the test runner in the interactive watch mode. See the section about running tests for more information.

Publish

Run yarn ship to publish new version of script.

yarn ship is an alias for npm publish

Learn More

This project was bootstrapped with Create React App. You can learn more in the Create React App documentation.

Copyright & License

Copyright (c) 2020 Ghost Foundation - Released under the MIT license.

0.9.1

4 years ago

0.9.0

4 years ago

0.8.25

4 years ago

0.8.24

4 years ago

0.8.23

4 years ago

0.8.22

4 years ago

0.8.21

4 years ago

0.8.20

4 years ago

0.8.19

4 years ago

0.8.18

4 years ago

0.8.17

4 years ago

0.8.16

4 years ago

0.8.15

4 years ago

0.8.14

4 years ago

0.8.13

4 years ago

0.8.12

4 years ago

0.8.11

4 years ago

0.8.9

4 years ago

0.8.10

4 years ago

0.8.8

4 years ago

0.8.7

4 years ago

0.8.5

4 years ago

0.8.6

4 years ago

0.8.4

4 years ago

0.8.3

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.3

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago