vite-plugin-html-elements 0.1.1 β†’ 0.1.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
@@ -194,9 +194,9 @@ htmlElements({
194
194
  });
195
195
  ```
196
196
 
197
- ### Non-Opinionated Mode
197
+ ### Custom Vite Configuration
198
198
 
199
- Take full control over your Vite configuration:
199
+ Take full control over your Vite configuration by disabling opinionated defaults:
200
200
 
201
201
  ```javascript
202
202
  export default defineConfig({
@@ -205,7 +205,7 @@ export default defineConfig({
205
205
  build: { outDir: 'build' },
206
206
  plugins: [
207
207
  htmlElements({
208
- defaults: false, // Disable opinionated defaults
208
+ defaults: false, // Disable opinionated defaults, use your Vite config
209
209
  srcDir: 'pages',
210
210
  }),
211
211
  ],
@@ -252,7 +252,7 @@ dist/
252
252
 
253
253
  ### Default Structure (Opinionated)
254
254
 
255
- When using `defaults: true` (the default):
255
+ By default, the plugin uses an opinionated structure:
256
256
 
257
257
  ```
258
258
  project/
@@ -435,7 +435,7 @@ Yes! Fully compatible with Tailwind and other CSS frameworks.
435
435
  Yes! Use `basePath: '/repo-name'` to match your repository name.
436
436
 
437
437
  **What's the difference between `defaults: true` and `defaults: false`?**
438
- `defaults: true` applies opinionated structure (`src/` as root, `public/`, `dist/`). Set to `false` to fully control your Vite config.
438
+ `defaults: true` (default) applies opinionated structure (`src/` as root, `public/`, `dist/`). Set to `false` to fully control your Vite config.
439
439
 
440
440
  **Can elements include JavaScript?**
441
441
  Yes! Elements are just HTML. Include `<script>` tags as needed.
package/dist/index.js CHANGED
@@ -62,22 +62,20 @@ function getRoutesEntries(routes, srcDir, debug) {
62
62
  console.error(`❌ Route source not found: ${route.source} for path ${route.path}`);
63
63
  return;
64
64
  }
65
+ // Normalize path: remove trailing slash (except for root)
66
+ const normalizedPath = route.path === '/' ? '/' : route.path.replace(/\/$/, '');
65
67
  // Convert route path to entry name
66
- // '/' -> 'index'
67
- // '/blog' -> 'blog/index'
68
- // '/blog/today-is-nice' -> 'blog/today-is-nice/index'
69
68
  let entryName;
70
- if (route.path === '/') {
69
+ if (normalizedPath === '/') {
71
70
  entryName = 'index';
72
71
  }
73
72
  else {
74
- // Remove leading slash and add /index for directory structure
75
- const cleanPath = route.path.replace(/^\//, '');
73
+ const cleanPath = normalizedPath.replace(/^\//, '');
76
74
  entryName = `${cleanPath}/index`;
77
75
  }
78
76
  entries[entryName] = sourcePath;
79
77
  if (debug) {
80
- console.log(`πŸ—ΊοΈ Route: ${route.path} -> ${route.source} (output: ${entryName}.html)`);
78
+ console.log(`πŸ—ΊοΈ Route: ${normalizedPath} -> ${route.source} (output: ${entryName}.html)`);
81
79
  }
82
80
  });
83
81
  return entries;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-html-elements",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Modular HTML without the JavaScript",
5
5
  "author": "Vincent Medina",
6
6
  "license": "MIT",