parcel-namer-rewrite
parcel-namer-rewrite copied to clipboard
Add some examples to the readme
Thanks for the nice and simple plugin. I never got the parcel-reporter-entries
plugin to work, so I didn't get to test this plugin for a long time. Maybe you should add some real world examples to the readme. The following rules help me to structure the dist folder::
"parcel-namer-rewrite": {
"rules": {
"(.*)\\.(css)": "css/$1.$2",
"(.*)\\.(js)": "js/$1.$2",
"(.*)\\.(woff2?)": "fonts/$1.$2",
"(.*)\\.(svg|png|gif|jpg)": "img/$1.$2"
}
},
Does it work with parcel2? Could you please show file package.json?
This works with Parcel2.
{
…
"scripts": {
"start": "parcel src/*.html",
"build": "parcel build src/*.html --no-source-maps --public-url ./",
"clean": "rimraf dist"
},
"targets": {
"app": {
"distDir": "./dist/"
}
},
"parcel-namer-rewrite": {
"rules": {
"(.*)\\.(css)": "css/$1.$2",
"(.*)\\.(js)": "js/$1.$2",
"(.*)\\.(woff2?)": "fonts/$1.$2",
"(.*)\\.(svg|png|gif|jpg)": "img/$1.$2"
},
"silent": true
},
"devDependencies": {
"@parcel/transformer-image": "^2.0.0",
"@parcel/transformer-sass": "^2.0.0",
"autoprefixer": "^10.3.7",
"parcel": "^2.0.0",
"parcel-namer-rewrite": "^2.0.0-rc.1",
"postcss": "^8.3.9",
"rimraf": "^3.0.2"
},
…
}
This works with Parcel2.
{ … "scripts": { "start": "parcel src/*.html", "build": "parcel build src/*.html --no-source-maps --public-url ./", "prebuild": "rimraf dist" }, "targets": { "app": { "distDir": "./dist/" } }, "parcel-namer-rewrite": { "rules": { "(.*)\\.(css)": "css/$1.$2", "(.*)\\.(js)": "js/$1.$2", "(.*)\\.(woff2?)": "fonts/$1.$2", "(.*)\\.(svg|png|gif|jpg)": "img/$1.$2" }, "silent": true }, "devDependencies": { "@parcel/transformer-image": "^2.0.0", "@parcel/transformer-sass": "^2.0.0", "autoprefixer": "^10.3.7", "parcel": "^2.0.0", "parcel-namer-rewrite": "^2.0.0-rc.1", "postcss": "^8.3.9", "rimraf": "^3.0.2" }, … }
This will only work if you have .parcelrc config file in the project, right?
{
"extends": "@parcel/config-default",
"namers": [ "parcel-namer-rewrite" ]
}
Yes, thats described in the readme of this plugin.
Yes, thats described in the readme of this plugin.
You helped a lot. Thanks =)
But if the same lines are added to package.json, it will not work. Works only if there is a .pracelrc file...