mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Renamed script init method
refs https://github.com/TryGhost/members.js/issues/6 - Renames script initialization method from `initMembersJS` to simply `init` - Updates readme
This commit is contained in:
parent
0a5e0648c8
commit
93a14eea2e
@ -13,14 +13,12 @@ To load members.js in any Ghost theme, add below code in theme's `default.hbs` b
|
||||
<script src="https://unpkg.com/@tryghost/members-js"></script>
|
||||
<script>
|
||||
// Initializes members.js
|
||||
window.GhostMembers.initMembersJS({
|
||||
adminUrl: 'https://youradminurl.com'
|
||||
window.GhostMembers.init({
|
||||
adminUrl: 'https://youradminurl.com' // Ex. localhost:2368/ghost
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Temp Note: You'll need [local Ghost setup](https://github.com/TryGhost/members.js#in-your-local-ghost-setup) on `membersjs` branch for member APIs to work at the moment.
|
||||
|
||||
## Basic Setup
|
||||
|
||||
1. Clone this repository:
|
||||
@ -38,19 +36,7 @@ yarn
|
||||
|
||||
## Configure for local development
|
||||
|
||||
#### In your local Ghost setup:
|
||||
|
||||
- Add `rish-upstream` as remote on your local Ghost repo -
|
||||
```
|
||||
git remote add rish-upstream git@github.com:rishabhgrg/Ghost.git
|
||||
```
|
||||
|
||||
|
||||
- Fetch and checkout membersjs branch from the remote -
|
||||
```
|
||||
git fetch rish-upstream membersjs && git checkout membersjs
|
||||
```
|
||||
- Ensure your local Ghost is running
|
||||
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):
|
||||
|
||||
@ -64,7 +50,7 @@ git fetch rish-upstream membersjs && git checkout membersjs
|
||||
<script src="{{asset "built/members.min.js"}}"></script>
|
||||
<script>
|
||||
// Initialize members.js
|
||||
window.GhostMembers.initMembersJS({
|
||||
window.GhostMembers.init({
|
||||
adminUrl: 'youradminurl.com'
|
||||
});
|
||||
</script>
|
||||
|
@ -9,7 +9,7 @@ function addRootDiv() {
|
||||
document.body.appendChild(elem);
|
||||
}
|
||||
|
||||
function initMembersJS(data) {
|
||||
function init(data) {
|
||||
addRootDiv();
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
@ -20,11 +20,11 @@ function initMembersJS(data) {
|
||||
}
|
||||
|
||||
window.GhostMembers = {
|
||||
initMembersJS: initMembersJS
|
||||
init: init
|
||||
};
|
||||
|
||||
// This will automatically load for local if an .env.development.local file is present
|
||||
if (process.env.REACT_APP_ADMIN_URL) {
|
||||
const adminUrl = process.env.REACT_APP_ADMIN_URL;
|
||||
initMembersJS({adminUrl});
|
||||
init({adminUrl});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user