Open ismay opened 10 years ago
After some fiddling, the only syntax that seems to work for me is:
build: {
files: [{
cwd: 'src/',
src: ['assets/ico/**/*.svg'],
dest: 'build/',
expand: false
}]
}
So I still don't know what exactly was going wrong, but hope this is of help!
Thanks @ismay, I'm glad you got it working :)
Recent changes had broke the old config options and I'm a bit behind on my Grunt files knowledge to understand exactly how it should work. I believe it's now correct though!
I'm glad you got it working :)
Me too :)! I think I made a couple of mistakes in the config at first, but the final config should have worked with expand:true
instead of expand:false
(if I'm not misinterpreting Grunt's documentation: http://gruntjs.com/configuring-tasks#files).
I believe it's now correct though!
Is it this commit that should have fixed the dynamic mapping: 72976354a8590212e1ebb2802932adf80ec938d3? Because I can take a look and see if everything's working as expected now, if you'd like.
Something happened between the last version and this one. I had been using the following config, which worked just fine:
svg2png: {
svg: {
files: [{
src: '<%= source %>/_assets/images/**/*.svg',
dest: '<%= source %>/assets/img'
}]
}
},
but now, I've had to modify it to this to make it work:
svg2png: {
svg: {
files: [{
expand: false,
cwd: '<%= source %>/_assets/images/',
src: ['**/*.svg'],
dest: '<%= source %>/assets/img'
}]
}
},
I am happy that I can still make it work, but it doesn't seem to follow the same structure as some of my other grunt tasks, and since it worked fine previously, something doesn't feel right here. Are there any plans to look into this, or do I change the config to what's working and move on? Thanks!
This doesn't seem to work anymore. If I do try this, the rasterization process just hangs up at 0, and nothing happens.
I'm using svg2png to render fallback png's and am encountering several bugs: when I run
grunt svg2png
with this config:it hangs at 0% when rasterizing.
Adding expand
When I add
expand:true
the rasterization works, but folder structure it outputs is wrong. Withsrc/assets/ico/test.svg
the result isbuild/test.png/src/assets/ico/test.png
. So it outputs the filename as a folder first and then messes up the folder structure (I believe it should bebuild/assets/ico/test.png
). When I fiddle around with thecwd
andsrc
it keeps outputting the filename as a folder.Removing ext
When I remove
ext:'png'
the folder structure becomes:build/test.svg/src/assets/ico/test.png
.Summary
expand:true
Any idea what's going wrong? To me it seems like there's something wrong with svg2png's implementation of grunt's dynamic mapping syntax, since similar syntax seems to work just fine with other plugins (copy for example).