Skip to content

Commit 2ac1f15

Browse files
authored
doc: fixing headings, mention in README.md, adding TailwindCSS steps (Kocal#589)
1 parent 21f6bfe commit 2ac1f15

File tree

6 files changed

+89
-7
lines changed

6 files changed

+89
-7
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ This template allows you to quickly start a web extension containing:
2525
- [git](https://git-scm.com)
2626
- [vue-cli 2](https://github.com/vuejs/vue-cli/tree/v2)
2727

28+
## Documentation
29+
30+
The documentation can be found on [vue-web-extension.netlify.app](https://vue-web-extension.netlify.app/). Please check the documentation website and the [open and closed issues](https://github.com/Kocal/vue-web-extension/issues?q=), before raising a new issue.
31+
2832
## Usage
2933

3034
```bash

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838
collapsable: false,
3939
children: [
4040
'development/Vue-Devtools',
41+
'development/TailwindCSS',
4142
],
4243
},
4344
{

docs/development/TailwindCSS.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Adding TailwindCSS Support
2+
3+
Using [TailwindCSS](https://tailwindcss.com/) is optional and needs to be configured, if desired. To style your extension popup or options page using Tailwind, you will need to install the required dependencies and configure the webpack build steps.
4+
5+
Below you find the required steps to configure Vue-Web-Extension for TailwindCSS.
6+
7+
1. Install dependencies `postcss-loader @fullhuman/postcss-purgecss`:
8+
9+
``` bash
10+
# with npm:
11+
npm install postcss-loader @fullhuman/postcss-purgecss tailwindcss --only=dev
12+
13+
# using yarn:
14+
yarn add postcss-loader @fullhuman/postcss-purgecss tailwindcss --dev
15+
```
16+
17+
2. Update your `webpack.config.js` to use `postcss-loader`:
18+
19+
``` diff
20+
{
21+
test: /\.css$/,
22+
+ use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader'],
23+
- use: [MiniCssExtractPlugin.loader, 'css-loader'],
24+
},
25+
```
26+
27+
3. Create a file called `postcss.config.js` next to your `webpack.config.js` with the following contents:
28+
29+
``` js
30+
/* eslint-disable import/no-extraneous-dependencies */
31+
const tailwindcss = require('tailwindcss');
32+
33+
const purgecss = require('@fullhuman/postcss-purgecss')({
34+
// Specify the paths to all of the template files in your project
35+
content: ['./src/**/*.vue'],
36+
37+
// Include any special characters you're using in this regular expression
38+
defaultExtractor: (content) => content.match(/[\w-/:]+(?<!:)/g) || [],
39+
40+
extractors: [
41+
// https://purgecss.com/guides/vue.html
42+
{
43+
extensions: ['vue'],
44+
extractor(content) {
45+
const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '');
46+
return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || [];
47+
},
48+
},
49+
],
50+
51+
whitelist: [],
52+
whitelistPatterns: [
53+
/-(leave|enter|appear)(|-(to|from|active))$/, // transitions
54+
/data-v-.*/, // scoped css
55+
],
56+
});
57+
58+
module.exports = {
59+
plugins: [tailwindcss(), ...(process.env.NODE_ENV === 'production' ? [purgecss] : [])],
60+
};
61+
```
62+
63+
4. Add Tailwind Directives:
64+
65+
To make the Tailwind classes available you need to add the following lines to your `src/popup/App.vue`-file:
66+
67+
``` vue
68+
<style>
69+
@tailwind base;
70+
@tailwind components;
71+
@tailwind utilities;
72+
</style>
73+
```
74+
75+
In a similar way you can add it to the options page of course.
76+
77+
Now you should be able to use the commonly used Tailwind classes in your web-extension.

docs/development/Vue-Devtools.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Using Vue Devtools on your popup
1+
# Using Vue Devtools in Your Popup
22

33
By default, you can't use [Vue Devtools](https://github.com/vuejs/vue-devtools) on your popup page. The issue has already been [discussed](https://github.com/vuejs/vue-devtools/issues/120) in Vue Devtools repository.
44

55
The GitHub user [@wujunchuan](https://github.com/wujunchuan) found a solution to make it works anyway.
66

7-
## Install and run Vue Devtools
7+
## Install and Run Vue Devtools
88

99
Install Vue Devtools (e.g.: `npm i -g @vue/devtools`) and then run `vue-devtools`.
1010

11-
## Configuring your extension
11+
## Configuring Your Extension
1212

1313
A new window opens, copy the first `<script>` (it should be something like `<script src="http://localhost:8098"></script>`).
1414

@@ -58,12 +58,12 @@ You also need to update Content Security Policy of your extension. For this, upd
5858
},
5959
```
6060

61-
::: tip
61+
::: tip Tips
6262
1. If running webpack in watch mode, you need to stop and restart webpack to apply configuration changes.
6363
2. You should disable and re-enable your extension in Chrome, to take care of `manifest.json` changes.
6464
:::
6565

66-
### Opening your popup
66+
### Opening Your Popup
6767

6868
After that, you can open your popup and normally you will see a message like `Connected to Vue.js devtools`.
6969

docs/intro/production-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Production workflow
1+
# Production Workflow
22

33
The following steps describe the intended release process and optional services to use (e.g. Travis).
44

docs/intro/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Getting started
1+
# Getting Started
22

33
Starting a new extension project using the boilerplate is done using [Vue CLI 2](https://github.com/vuejs/vue-cli/tree/v2#vue-cli--). Installation steps for Vue CLI are provided on the website.
44

0 commit comments

Comments
 (0)