Skip to content

copy static images w/o renaming them? #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ralyodio opened this issue Jul 14, 2014 · 3 comments
Closed

copy static images w/o renaming them? #347

ralyodio opened this issue Jul 14, 2014 · 3 comments
Labels

Comments

@ralyodio
Copy link

I have some static images that my API assumes are always the same name.

The grunt build step will rename foo.png to ./public/images/xxxxxx-foo.png for caching reasons. However my API has no way of knowing what the new image filename is at runtime. Is there anyway to skip renaming of certain images?

Image in question is ./app/images/default-profile-image.png. The API will return a url to that image and assumes it is not renamed.

@DaftMonk
Copy link
Member

Rewrites are performed by the grunt rev task:

rev: {
  dist: {
    files: {
      src: [
        '<%%= yeoman.dist %>/public/scripts/{,*/}*.js',
        '<%%= yeoman.dist %>/public/styles/{,*/}*.css',
        '<%%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
        '<%%= yeoman.dist %>/public/styles/fonts/*'
      ]
    }
  }
},

You can exclude files the same way you do with any grunt task, with a negative matching pattern at the end of the src files list, e.g.

'!<%%= yeoman.dist %>/public/images/nocache/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'

@ralyodio
Copy link
Author

It still renamed them.

On Sun, Jul 13, 2014 at 10:18 PM, Tyler Henkel [email protected]
wrote:

Rewrites are performed by the grunt rev task:

rev: {
dist: {
files: {
src: [
'<%%= yeoman.dist %>/public/scripts/{,/}.js',
'<%%= yeoman.dist %>/public/styles/{,/}.css',
'<%%= yeoman.dist %>/public/images/{,/}.{png,jpg,jpeg,gif,webp,svg}',
'<%%= yeoman.dist %>/public/styles/fonts/*'
]
}
}
},

You need can exclude files the same way you do with any grunt task, with a
negative matching pattern at the end of the src files list, e.g.

'!<%%= yeoman.dist %>/public/images/nocache/{,/}
.{png,jpg,jpeg,gif,webp,svg}',

Reply to this email directly or view it on GitHub
#347 (comment)
.

Anthony Ettinger
http://about.me/anthony.ettinger
[email protected]
+1 (831) 406-1123

@ralyodio
Copy link
Author

This fixed it:

'!<%= yeoman.dist %>/public/images/cache/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' //do not cachebust these files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants