|
10 | 10 |
|
11 | 11 | Serving extensions and themes locally is useful for rapid development without requiring the use of the XKit Editor, but some initial set up is required: |
12 | 12 |
|
13 | | -1. Run `gulp server` to start the resource server. This task will automatically build the extension and theme files from source before the server starts. See [`gulp server`](#gulp-server) for more information. |
14 | | -2. Navigate to `https://localhost:31337` and create a security exception for the `localhost` domain. The project uses self-signed SSL/TLS certificates that are untrusted by default in order to work around mixed-content warnings for websites like Tumblr that are served over HTTPS. |
15 | | -3. Change [the relevant lines](https://gist.github.com/hobinjk/4b0ae4698d4e35320d3c977753946cf5) in xkit.js and manifest.json to point to and allow serving XKit from `localhost`. |
| 13 | +1. Run `npm run watch-extensions` to start the resource server. This task will automatically build the extension and theme files from source whenever they are changed, storing them in `Extensions/dist`. |
| 14 | +2. Change these lines in xkit.js and manifest.json to point the XKit updater at `Extensions/dist`: |
| 15 | + |
| 16 | +```diff |
| 17 | +diff --git a/manifest.json b/manifest.json |
| 18 | +index 9e964097..52c4119c 100644 |
| 19 | +--- a/manifest.json |
| 20 | ++++ b/manifest.json |
| 21 | +@@ -33,7 +33,7 @@ |
| 22 | + "author": "New XKit Team", |
| 23 | + "permissions": ["storage", "unlimitedStorage", "*://*.tumblr.com/*", "https://new-xkit.github.io/XKit/*", "https://cloud.new-xkit.com/*" ], |
| 24 | + "version": "7.9.2", |
| 25 | +- "web_accessible_resources": [ "manifest.json", "editor.js" ], |
| 26 | ++ "web_accessible_resources": [ "*.json", "editor.js" ], |
| 27 | + "applications": { |
| 28 | + "gecko": { |
| 29 | + "id": "@new-xkit", |
| 30 | +diff --git a/xkit.js b/xkit.js |
| 31 | +index d5b0cfd8..719402e1 100755 |
| 32 | +--- a/xkit.js |
| 33 | ++++ b/xkit.js |
| 34 | +@@ -192,7 +192,7 @@ var xkit_global_start = Date.now(); // log start timestamp |
| 35 | + download: { |
| 36 | + // TODO: implement as module, lose most of this code |
| 37 | + github_fetch: function(path, callback) { |
| 38 | +- var url = 'https://new-xkit.github.io/XKit/Extensions/dist/' + path; |
| 39 | ++ var url = browser.runtime.getURL('/Extensions/dist/') + path; |
| 40 | + GM_xmlhttpRequest({ |
| 41 | + method: "GET", |
| 42 | + url: url, |
| 43 | +``` |
| 44 | + |
16 | 45 | 4. Reload the XKit extension in the browser under test: |
17 | 46 | - Chrome: [reload the unpacked extension](https://developer.chrome.com/extensions/getstarted#unpacked) |
18 | 47 | - Firefox: [reload the temporary add-on](https://developer.mozilla.org/en-US/docs/Tools/about:debugging#Extensions) |
|
0 commit comments