Reputation: 4014
So I'm in the situation where I have added a font to my Yeoman
project. There is however a small problem. Whenever I run grunt build
the file name of my font is changed, but it doesn't change in my CSS
causing it to not work.
How can I fix this. I know that I have to look inside my Gruntfile.js
but I have no idea where to look.
I already tried this:
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
js: ['<%= yeoman.dist %>/public/{,*/}*.js'],
options: {
assetsDirs: [
'<%= yeoman.dist %>/public',
'<%= yeoman.dist %>/public/assets/images',
'<%= yeoman.dist %>/public/assets/fonts'
],
// This is so we update image references in our ng-templates
patterns: {
js: [
[/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
],
css: [
[/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the CSS to reference our revved images']
]
}
}
},
Because I figured that if I could have it change the name in my CSS aswell it might work. But this doesn't really fix anything :-(
UPDATE
As requested here is the changes in the file name
Before:
ITCEDSCR.TTF
After
20118b60.ITCEDSCR.TTF
Upvotes: 0
Views: 84
Reputation: 4014
Thanks to Fer To's link I found a solution. It is kinda what he suggested, just had to change the code somewhere else as well.
This was my solution:
// Renames files for browser caching purposes
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/public/{,*/}*.js',
'<%= yeoman.dist %>/public/{,*/}*.css',
//'<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
//'<%= yeoman.dist %>/public/assets/fonts/*'
]
}
}
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
js: ['<%= yeoman.dist %>/public/{,*/}*.js'],
options: {
assetsDirs: [
'<%= yeoman.dist %>/public',
'<%= yeoman.dist %>/public/assets/images'
],
// This is so we update image references in our ng-templates
patterns: {
js: [
[/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
]
}
}
},
Upvotes: 1
Reputation: 1517
According to https://github.com/yeoman/generator-webapp/issues/459 ->
{
usemin: {
options: {
assetsDirs: [
'<%%= config.dist %>',
'<%%= config.dist %>/images',
'<%%= config.dist %>/styles'
]
},
html: ['<%%= config.dist %>/{,*/}*.html'],
css: ['<%%= config.dist %>/styles/{,*/}*.css']
}
}
Getting rid of the fonts should help I guess ?
Upvotes: 1