vite-pug-adapter 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,14 +4,13 @@ A simple Vite plugin that serves Pug files directly without physical HTML files.
4
4
  ## Features
5
5
  - No dirties. No physical HTML in your root.
6
6
  - Simple usage. No configs.
7
- - Serve Pug files to Vite as if they were html files.
7
+ - Serves Pug files to Vite as if they were html files.
8
8
 
9
9
  ## Installation
10
10
  ```bash
11
11
  npm install -D vite-pug-adapter pug
12
12
  ```
13
- ```vite.config.js
14
- //vite.config.js
13
+ ```javascript
15
14
  // vite.config.js
16
15
  import vite_pug_adapter from 'vite-pug-adapter';
17
16
 
@@ -20,6 +19,12 @@ export default {
20
19
  };
21
20
  ```
22
21
 
22
+ ## Minimal Example
23
+ Following is ready-to-run example.
24
+ Try it by using ``npm run dev`` after cloning it.
25
+
26
+ https://github.com/mtugb/-vite-pug-adapter-example1
27
+
23
28
  ## Caution
24
- This **only** compiles Pug files in your root dir, then if you need to put Pug files in other places such as /src, you should use anothor module.
29
+ This **only** compiles Pug files in your root dir, then if you need to put Pug files in other places, such as ``/src``, you should use another module.
25
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-pug-adapter",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "vite put adapter",
5
5
  "keywords": [
6
6
  "vite",
package/src/index.js CHANGED
@@ -5,7 +5,7 @@ const vite_pug_adapter = {
5
5
  configureServer: function (server) {
6
6
  server.middlewares.use(async (req, res, next) => {
7
7
  // normal page
8
- if (/^\/[a-zA-Z]*$/.test(req.url)) {
8
+ if (/^\/[a-zA-Z0-9_-]*$/.test(req.url)) {
9
9
  const pug_path = req.url === "/" ? "/index" : req.url;
10
10
  try {
11
11
  let html = pug.renderFile(`${process.cwd()}${pug_path}.pug`);