diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/gitbook-plugin-copy-code/package.json | 56 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/README.md | 5 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/_assets/plugin.js | 26 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/book/plugin.js | 11 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/index.js | 8 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/package.json | 42 | ||||
-rw-r--r-- | packages/gitbook-plugin-livereload/src/index.js | 18 | ||||
-rw-r--r-- | packages/gitbook/package.json | 2 |
8 files changed, 101 insertions, 67 deletions
diff --git a/packages/gitbook-plugin-copy-code/package.json b/packages/gitbook-plugin-copy-code/package.json index b25ca43..97147b1 100644 --- a/packages/gitbook-plugin-copy-code/package.json +++ b/packages/gitbook-plugin-copy-code/package.json @@ -1,29 +1,29 @@ { - "name": "gitbook-plugin-copy-code", - "description": "Button to copy code blocks", - "main": "index.js", - "browser": "./_assets/plugin.js", - "version": "4.0.0", - "dependencies": { - "copy-to-clipboard": "^3.0.5", - "gitbook-core": "4.0.0" - }, - "devDependencies": { - "gitbook-plugin": "4.0.0" - }, - "engines": { - "gitbook": ">=3.0.0" - }, - "scripts": { - "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", - "prepublish": "npm run build-js" - }, - "homepage": "https://github.com/GitbookIO/gitbook", - "repository": { - "type": "git", - "url": "https://github.com/GitbookIO/gitbook.git" - }, - "bugs": { - "url": "https://github.com/GitbookIO/gitbook/issues" - } -} + "name": "gitbook-plugin-copy-code", + "description": "Button to copy code blocks", + "main": "index.js", + "browser": "./_assets/plugin.js", + "version": "4.0.0", + "dependencies": { + "copy-to-clipboard": "^3.0.5", + "gitbook-core": "4.0.0" + }, + "devDependencies": { + "gitbook-plugin": "4.0.0" + }, + "engines": { + "gitbook": ">=3.0.0" + }, + "scripts": { + "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", + "prepublish": "npm run build-js" + }, + "homepage": "https://github.com/GitbookIO/gitbook", + "repository": { + "type": "git", + "url": "https://github.com/GitbookIO/gitbook.git" + }, + "bugs": { + "url": "https://github.com/GitbookIO/gitbook/issues" + } +}
\ No newline at end of file diff --git a/packages/gitbook-plugin-livereload/README.md b/packages/gitbook-plugin-livereload/README.md index 5eccd1f..e2d6f83 100644 --- a/packages/gitbook-plugin-livereload/README.md +++ b/packages/gitbook-plugin-livereload/README.md @@ -1,2 +1,3 @@ -Live reloading for GitBook -========================== +# `gitbook-plugin-livereload` + +See [GitBook](https://github.com/GitbookIO/gitbook) for more information. diff --git a/packages/gitbook-plugin-livereload/_assets/plugin.js b/packages/gitbook-plugin-livereload/_assets/plugin.js new file mode 100644 index 0000000..6347fb8 --- /dev/null +++ b/packages/gitbook-plugin-livereload/_assets/plugin.js @@ -0,0 +1,26 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GitBookPlugin = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ +'use strict'; + +var GitBook = require('gitbook-core'); + +module.exports = GitBook.createPlugin({ + activate: function activate(dispatch, getState, _ref) { + var Components = _ref.Components; + + if (typeof window === 'undefined') { + return; + } + + var newEl = document.createElement('script'); + var firstScriptTag = document.getElementsByTagName('script')[0]; + + if (firstScriptTag) { + newEl.async = 1; + newEl.src = '//' + window.location.hostname + ':35729/livereload.js'; + firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag); + } + } +}); + +},{"gitbook-core":"gitbook-core"}]},{},[1])(1) +});
\ No newline at end of file diff --git a/packages/gitbook-plugin-livereload/book/plugin.js b/packages/gitbook-plugin-livereload/book/plugin.js deleted file mode 100644 index 923b3ae..0000000 --- a/packages/gitbook-plugin-livereload/book/plugin.js +++ /dev/null @@ -1,11 +0,0 @@ -(function() { - var newEl = document.createElement('script'), - firstScriptTag = document.getElementsByTagName('script')[0]; - - if (firstScriptTag) { - newEl.async = 1; - newEl.src = '//' + window.location.hostname + ':35729/livereload.js'; - firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag); - } - -})(); diff --git a/packages/gitbook-plugin-livereload/index.js b/packages/gitbook-plugin-livereload/index.js deleted file mode 100644 index 1fe6db4..0000000 --- a/packages/gitbook-plugin-livereload/index.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - book: { - assets: "./book", - js: [ - "plugin.js" - ] - } -};
\ No newline at end of file diff --git a/packages/gitbook-plugin-livereload/package.json b/packages/gitbook-plugin-livereload/package.json index 80dc217..132ef95 100644 --- a/packages/gitbook-plugin-livereload/package.json +++ b/packages/gitbook-plugin-livereload/package.json @@ -1,18 +1,26 @@ { - "name": "gitbook-plugin-livereload", - "description": "Live reloading for your gitbook", - "main": "index.js", - "version": "0.0.1", - "engines": { - "gitbook": "*" - }, - "homepage": "https://github.com/davidagraf/gitbook-plugin-livereload", - "repository": { - "type": "git", - "url": "https://github.com/davidagraf/gitbook-plugin-livereload.git" - }, - "license": "Apache 2", - "bugs": { - "url": "https://github.com/davidagraf/gitbook-plugin-livereload/issues" - } -} + "name": "gitbook-plugin-livereload", + "description": "Live reloading for your gitbook", + "main": "index.js", + "browser": "./_assets/plugin.js", + "version": "4.0.0", + "engines": { + "gitbook": "*" + }, + "dependencies": { + "gitbook-core": "4.0.0" + }, + "scripts": { + "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", + "prepublish": "npm run build-js" + }, + "homepage": "https://github.com/GitbookIO/gitbook", + "repository": { + "type": "git", + "url": "https://github.com/GitbookIO/gitbook.git" + }, + "license": "Apache 2", + "bugs": { + "url": "https://github.com/GitbookIO/gitbook/issues" + } +}
\ No newline at end of file diff --git a/packages/gitbook-plugin-livereload/src/index.js b/packages/gitbook-plugin-livereload/src/index.js new file mode 100644 index 0000000..e73f12d --- /dev/null +++ b/packages/gitbook-plugin-livereload/src/index.js @@ -0,0 +1,18 @@ +const GitBook = require('gitbook-core'); + +module.exports = GitBook.createPlugin({ + activate: (dispatch, getState, { Components }) => { + if (typeof window === 'undefined') { + return; + } + + const newEl = document.createElement('script'); + const firstScriptTag = document.getElementsByTagName('script')[0]; + + if (firstScriptTag) { + newEl.async = 1; + newEl.src = '//' + window.location.hostname + ':35729/livereload.js'; + firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag); + } + } +}); diff --git a/packages/gitbook/package.json b/packages/gitbook/package.json index 6cb3f2c..6531536 100644 --- a/packages/gitbook/package.json +++ b/packages/gitbook/package.json @@ -27,7 +27,7 @@ "gitbook-plugin-copy-code": "4.0.0", "gitbook-plugin-headings": "4.0.0", "gitbook-plugin-highlight": "4.0.0", - "gitbook-plugin-livereload": "0.0.1", + "gitbook-plugin-livereload": "4.0.0", "gitbook-plugin-lunr": "4.0.0", "gitbook-plugin-search": "4.0.0", "gitbook-plugin-sharing": "4.0.0", |