Skip to content

Commit 8197a5f

Browse files
committed
update "Serving Resources Locally" docs
1 parent 033f983 commit 8197a5f

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

docs/contributing/Build-XKit.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,38 @@
1010

1111
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:
1212

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+
1645
4. Reload the XKit extension in the browser under test:
1746
- Chrome: [reload the unpacked extension](https://developer.chrome.com/extensions/getstarted#unpacked)
1847
- Firefox: [reload the temporary add-on](https://developer.mozilla.org/en-US/docs/Tools/about:debugging#Extensions)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"license": "GPL-3.0",
44
"scripts": {
55
"build-extensions": "node dev/build.mjs",
6+
"watch-extensions": "npx nodemon --ext js,css dev/build.mjs",
67
"test": "eslint .",
78
"lint": "web-ext lint",
89
"build": "web-ext build",

0 commit comments

Comments
 (0)