samrith-s / parcel-plugin-structurize

A plugin to customize the output (dist) directory structure during production.
MIT License
41 stars 6 forks source link

[🐛] Bug: Some assets not properly referenced #29

Closed 3ub41r closed 3 years ago

3ub41r commented 3 years ago

Some of the assets are not properly referenced.

This is my parcel-plugin-structurize.json file:

{
    "rules": [
        {
            "match": "*.js",
            "folder": "js"
        },
        {
            "match": "*.css",
            "folder": "css"
        },
        {
            "match": "*.{jpg,jpeg,jpeg2,png,gif,svg,bmp,webp}",
            "folder": "images"
        }
    ]
}

Expected behavior

I have configured the plugin to move .css files to the directory css.

The files are moved appropriately, but when it is referenced from the HTML the directory is not taken into consideration. I have included a screenshot of the generated HTML to illustrate what I mean.

Screenshots

This is the generated HTML.

image

Information

Thanks for all your effort. I not very proficient in Javascript, sorry. Let me know if there is something I've missed.

xxidbr9 commented 3 years ago

I'm facing the same bug when trying to build my projects

here my rules config on package.json image

and i got my css link are not correct image

Version: 2.3.1

Thanks btw

samrith-s commented 3 years ago

Hello @xxidbr9 and @3ub41r thank you for the report!

Could you guys provide a minimal reproducible repository so I can debug it quicker?

Alternatively, can you set the verbose and displayAssetsMap option to true in the config and copy-paste the output here?

{
    "verbose": true,
    "displayAssetsMap": true,
    "rules": [
        // your rules
    ]
}

Sorry for the delayed response, I was on vacation.

samrith-s commented 3 years ago

I'm facing the same bug when trying to build my projects

here my rules config on package.json image

and i got my css link are not correct image

Version: 2.3.1

Thanks btw

For this particular thing, can you try removing all *.*.map? The plugin automatically moves all the corresponding map files to the relevant directory. So the JS and CSS maps would be moved automatically. See the second Gotcha.

samrith-s commented 3 years ago

@3ub41r @xxidbr9 I tried both your config files, and everything works fine on my end. You can check it here:

@3ub41r output Configuration: ```json { "verbose": true, "displayAssetsMap": true, "rules": [ { "match": "*.js", "folder": "js" }, { "match": "*.css", "folder": "css" }, { "match": "*.{jpg,jpeg,jpeg2,png,gif,svg,bmp,webp}", "folder": "images" } ] } ``` HTML: ```html Parcel Plugin Structurize - Basic Parcel plugin structurize test! HTML5 logo

``` Output: ![image](https://user-images.githubusercontent.com/9032162/103960359-42834780-5152-11eb-8bf4-d354a953a9d1.png)
@xxidbr9 output Configuration: ```json { "verbose": true, "displayAssetsMap": true, "rules": [ { "match": "*.{js,js.map}", "folder": "assets/js" }, { "match": "*.{css,css.map}", "folder": "assets/css" }, { "match": "*.{png,svg,jpg,jpg2,jpeg,gif,bmp,webm,webp}", "folder": "assets/img" } ] } ``` HTML: ```html Parcel Plugin Structurize - Basic Parcel plugin structurize test! HTML5 logo

``` Output: ![image](https://user-images.githubusercontent.com/9032162/103960603-d48b5000-5152-11eb-9a32-3803504186d1.png)

You can also check that all the tests pass for all the supported Node versions and all OSes.

xxidbr9 commented 3 years ago

yes it fix, thanks alot 🎉👏🏻

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.