You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2022. It is now read-only.
A basic foundation boilerplate for rich Chrome Extensions using [Webpack](https://webpack.github.io/) to help you write modular and modern Javascript code, load CSS easily and [automatic reload the browser on code changes](https://webpack.github.io/docs/webpack-dev-server.html#automatic-refresh).
3
+
A dead simple chrome extension for clipping selections from web pages.
4
4
5
-
## Developing a new extension
6
-
_I'll assume that you already read the [Webpack docs](https://webpack.github.io/docs) and the [Chrome Extension](https://developer.chrome.com/extensions/getstarted) docs._
5
+
It allows selection of parts of a webpage and downloads the clipped content as a standalone HTML file preserving the original look and feel as closely as possible. This file can be opened and previewed in any standard web browser.
6
+
7
+
## TODO
8
+
9
+
[] Support for shadow dom.
10
+
[] Support for downloading fonts.
11
+
[] Support for frames and iframes.
12
+
[] Annotating clips before download
13
+
[] Editing and previewing clips
14
+
15
+
## Non-goals
16
+
17
+
- Synchronization support
18
+
- Dependency on proprietary web services
19
+
20
+
## About Fluid Notion
21
+
22
+
[Fluid Notion](https://github.com/fluid-notion) is a suite of minimal open-source productivity tools.
23
+
24
+
## Development
25
+
26
+
This plugin was based on [Samuel Simões](https://twitter.com/samuelsimoes)'s [Chrome extension boilerplate](https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate).
@@ -18,86 +40,11 @@ _I'll assume that you already read the [Webpack docs](https://webpack.github.io/
18
40
4. Select the `build` folder.
19
41
8. Have fun.
20
42
21
-
## Structure
22
-
All your extension's development code must be placed in `src` folder, including the extension manifest.
23
-
24
-
The boilerplate is already prepared to have a popup, a options page and a background page. You can easily customize this.
25
-
26
-
Each page has its own [assets package defined](https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate/blob/master/webpack.config.js#L16-L20). So, to code on popup you must start your code on `src/js/popup.js`, for example.
27
-
28
-
You must use the [ES6 modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) to a better code organization. The boilerplate is already prepared to that and [here you have a little example](https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate/blob/master/src/js/popup.js#L2-L4).
29
-
30
-
## Webpack auto-reload and HRM
31
-
To make your workflow much more efficient this boilerplate uses the [webpack server](https://webpack.github.io/docs/webpack-dev-server.html) to development (started with `npm run server`) with auto reload feature that reloads the browser automatically every time that you save some file o your editor.
32
-
33
-
You can run the dev mode on other port if you want. Just specify the env var `port` like this:
34
-
35
-
```
36
-
$ PORT=6002 npm run start
37
-
```
38
-
39
-
## Content Scripts
40
-
41
-
Although this boilerplate uses the webpack dev server, it's also prepared to write all your bundles files on the disk at every code change, so you can point, on your extension manifest, to your bundles that you want to use as [content scripts](https://developer.chrome.com/extensions/content_scripts), but you need to exclude these entry points from hot reloading [(why?)](https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate/issues/4#issuecomment-261788690). To do so you need to expose which entry points are content scripts on the `webpack.config.js` using the `chromeExtensionBoilerplate -> notHotReload` config. Look the example below.
42
-
43
-
Let's say that you want use the `myContentScript` entry point as content script, so on your `webpack.config.js` you will configure the entry point and exclude it from hot reloading, like this:
44
-
45
-
```js
46
-
{
47
-
…
48
-
entry: {
49
-
myContentScript:"./src/js/myContentScript.js"
50
-
},
51
-
chromeExtensionBoilerplate: {
52
-
notHotReload: ["myContentScript"]
53
-
}
54
-
…
55
-
}
56
-
```
57
-
58
-
and on your `src/manifest.json`:
59
-
60
-
```json
61
-
{
62
-
"content_scripts": [
63
-
{
64
-
"matches": ["https://www.google.com/*"],
65
-
"js": ["myContentScript.bundle.js"]
66
-
}
67
-
]
68
-
}
69
-
70
-
```
71
-
72
43
## Packing
44
+
73
45
After the development of your extension run the command
74
46
75
47
```
76
48
$ NODE_ENV=production npm run build
77
49
```
78
-
Now, the content of `build` folder will be the extension ready to be submitted to the Chrome Web Store. Just take a look at the [official guide](https://developer.chrome.com/webstore/publish) to more infos about publishing.
79
-
80
-
## Secrets
81
-
If you are developing an extension that talks with some API you probably are using different keys for testing and production. Is a good practice you not commit your secret keys and expose to anyone that have access to the repository.
82
-
83
-
To this task this boilerplate import the file `./secrets.<THE-NODE_ENV>.js` on your modules through the module named as `secrets`, so you can do things like this:
84
-
85
-
_./secrets.development.js_
86
-
87
-
```js
88
-
exportdefault { key:"123" };
89
-
```
90
-
91
-
_./src/popup.js_
92
-
93
-
```js
94
-
importsecretsfrom"secrets";
95
-
ApiCall({ key:secrets.key });
96
-
```
97
-
:point_right: The files with name `secrets.*.js` already are ignored on the repository.
98
-
99
-
## With React.js
100
-
:bulb: If you want use [React.js](https://facebook.github.io/react/) with this boilerplate, check the **[react branch](https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate/tree/react)**.
101
-
102
-
-------------
103
-
Samuel Simões ~ [@samuelsimoes](https://twitter.com/samuelsimoes) ~ [Blog](http://blog.samuelsimoes.com/)
50
+
Now, the content of `build` folder will be the extension ready to be submitted to the Chrome Web Store. Just take a look at the [official guide](https://developer.chrome.com/webstore/publish) to more information.
<div>Captured from <strong><a href="${location.href}">${location.href}</a></strong> at <strong>${newDate()}</strong> using <strong style="color: rgb(144, 67, 153)">Minimal Web Clipper</strong></div>
0 commit comments