Open weilinzung opened 7 years ago
???
Same problem
I tried reproducing weilinzung's case, but replacement in JSON files works just fine here. Could you provide the gulp task you're using, and your rev-manifest.json
?
It is actual only export with revision name manifest-128fcfa762.json
, but the image path inside of the .json
& .xml
would not change. If the xxx.js
& xxx.css
has image path, it would actual changed and everything works fine.
Current Result:
manifest-128fcfa762.json
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/android-icon-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/android-icon-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/android-icon-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/android-icon-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}
browserconfig-653d077300.xml
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/ms-icon-70x70.png"/>
<square150x150logo src="/ms-icon-150x150.png"/>
<square310x310logo src="/ms-icon-310x310.png"/>
<TileColor>#ffffff</TileColor></tile>
</msapplication>
</browserconfig>
Expected Result:
manifest-b58fcfa762.json
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36-sd5sdffa12.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
...
]
}
browserconfig-653d077300.xml
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/ms-icon-70x70-xd5sdffa12.png"/>
...
<TileColor>#ffffff</TileColor></tile>
</msapplication>
</browserconfig>
Yes, but can you show the gulp task that you're using? It's hard to guess what you're doing wrong otherwise.
sure.
var gulp = require('gulp');
var rev = require('gulp-rev');
var revReplace = require('gulp-rev-replace');
gulp.task("index", function() {
return gulp.src(['_site/**/*.jpg','_site/**/*.png','_site/**/*.json','_site/**/*.js','_site/**/*.css','_site/**/*.xml'])
.pipe(rev())
.pipe(revReplace({
replaceInExtensions: ['.js', '.css', '.html', '.hbs', '.json','.xml']
}))
.pipe(gulp.dest('_site'));
});
The default options.replaceInExtensions
doesn't have .json
& .xml
, so I don't think it is supported and that is why I am asking to add those.
thanks!
The list of globs that you pass to gulp.src
should be an array, like this:
gulp.src(['_site/**/*.jpg','_site/**/*.png','_site/**/*.json','_site/**/*.js','_site/**/*.css','_site/**/*.xml'])
I don't think that could make the .json & .xml
works... It is about this plugin feature...
I try what you said, nothing really happens.
Have you tried using a rev-manifest.json
file as described here?
Yes. not working~
That idea is just to create a new reference JSON, doesn't change the value inside of the existing .json
or .xml
files.
I think you don't understand this issue is gulp-rev-replace
that doesn't support .json & .xml
extensions. Right now, only re-reference the file name but not re-reference the new filenames inside of .json & .xml
.
The problem is the list of FRONT_DELIMITERS
and BACK_DELIMITERS
in lib/replace.js
addition of a <
and a >
allows it to work for XML files as well.
@akixi-johnathonclark
Do you have examples of common xml lines in which a filename appears just after <
or before >
?
Hi,
options.replaceInExtensions Type: Array Default: ['.js', '.css', '.html', '.hbs']
For this, would this option support
.json
and.xml
? I add it to mygulp-rev
code, every types list on the doc is working fine, except.json
and.xml
, all the revision images are not updating within the.json
and.xml
.issue related to: https://github.com/sindresorhus/gulp-rev/issues/214
thanks!