When I first created this plugin over a year ago, I had no plans to maintain it. It was just something to fulfil a requirement at work.
This project is doing reasonably well, and though I don't provide regular updates, I am keen on giving it a complete revamp. This issue will be the point of discussion for everything pertaining to v2 of this plugin.
The plugin now uses Typescript. This choice has been made keeping in mind the number of people making the switch to it and also in terms of maintainability and code discoverability.
As of 19/08/2020, the plugin engine support is currently:
"node": ">=12"
The previous version supported up to node@v8. If there is a strong enough case, I might still consider adding support for node@v10.
v2 Feature List
Support user-defined structures ✅
Users will have fine-grained control over where certain files go and can group using a multitude of options.
Example:
```jsonc
[
{
"files": ".{jpg,png,gif,bmp,webp}",
"folder": "images"
},
{
"files": "*.svg",
"folder": "vectors"
}
]
```
Configuration file ✅
Configuration using `parcel-structurize.json` or `parcel-plugin-structurize` key in `package.json`. This will help the user declutter `package.json`. The plugin will still ship with sane defaults to power zero-config integration.
Rework file targeting to enable multiple different sources of inputs ✅
Remove the restriction of the plugin wherein it acts only on `.html` input sources. If there are no `.html` input sources, there is a lot of redundant code that runs. This rework should also make the plugin faster.
Better logging ✅
Provide a map of all the resources changes upon completion. Right now user sees no information about updates to the output.
Contributions & Testing
To help test this, simple clone the repository and checkout to the v2 branch (it is already the default branch). To test it out in your project, you can run:
Custom tags
With the new configuration users can provide tags that the plugin should target Tags can be any valid HTML selector.
Example:
```jsonc
[
{
"files": ".{css,svg}",
"folder": "assets",
"source": "link[rel='stylesheet'], img[src*='.svg']"
}
]
```
> The plugin no longer iterates over HTML files to find and replace instances. This also means JSDOM is no longer a dependency.
Enable use of either globs or regexes
The `files` option in the new configuration will be able to accept glob patterns or regexes for more fine-tuning.
Example:
```jsonc
[
{
// glob match - Selects all CSS and SVG files
"files": ".{css,svg}",
"folder": "assets"
},
{
// regex match - Selects all files with names .vendor.js,
"files": /(vendor\.js)$/,
"folder": "vendor"
}
]
```
> Glob pattern already allows specifying complicated matches. Regex support is hence dropped.
When I first created this plugin over a year ago, I had no plans to maintain it. It was just something to fulfil a requirement at work.
This project is doing reasonably well, and though I don't provide regular updates, I am keen on giving it a complete revamp. This issue will be the point of discussion for everything pertaining to
v2
of this plugin.Releases
Foundation
The plugin now uses Typescript. This choice has been made keeping in mind the number of people making the switch to it and also in terms of maintainability and code discoverability.
As of 19/08/2020, the plugin engine support is currently:
The previous version supported up to
node@v8
. If there is a strong enough case, I might still consider adding support fornode@v10
.v2
Feature ListSupport user-defined structures ✅
Users will have fine-grained control over where certain files go and can group using a multitude of options. Example: ```jsonc [ { "files": ".{jpg,png,gif,bmp,webp}", "folder": "images" }, { "files": "*.svg", "folder": "vectors" } ] ```Configuration file ✅
Configuration using `parcel-structurize.json` or `parcel-plugin-structurize` key in `package.json`. This will help the user declutter `package.json`. The plugin will still ship with sane defaults to power zero-config integration.Rework file targeting to enable multiple different sources of inputs ✅
Remove the restriction of the plugin wherein it acts only on `.html` input sources. If there are no `.html` input sources, there is a lot of redundant code that runs. This rework should also make the plugin faster.Better logging ✅
Provide a map of all the resources changes upon completion. Right now user sees no information about updates to the output.
Contributions & Testing
To help test this, simple clone the repository and checkout to the
v2
branch (it is already the default branch). To test it out in your project, you can run:Bugs
To report bugs please use the
v2
bug report template.Dropped features
Custom tags
With the new configuration users can provide tags that the plugin should target Tags can be any valid HTML selector. Example: ```jsonc [ { "files": ".{css,svg}", "folder": "assets", "source": "link[rel='stylesheet'], img[src*='.svg']" } ] ``` > The plugin no longer iterates over HTML files to find and replace instances. This also means JSDOM is no longer a dependency.Enable use of either globs or regexes
The `files` option in the new configuration will be able to accept glob patterns or regexes for more fine-tuning. Example: ```jsonc [ { // glob match - Selects all CSS and SVG files "files": ".{css,svg}", "folder": "assets" }, { // regex match - Selects all files with names