Skip to content

Commit

Permalink
Fix docs for the filename option
Browse files Browse the repository at this point in the history
Fixes #355
  • Loading branch information
sindresorhus committed Feb 16, 2019
1 parent 396912f commit ab861ad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ module.exports = grunt => {
],
dest: 'temp'
}
},
filenameOption: {
options: {
urls: [
'https://sindresorhus.com'
],
sizes: [
'1000x1000'
],
filename: 'filename-option-{{url}}',
dest: 'temp'
}
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ Tip: Go to the website you want a cookie for and [copy-paste it from DevTools](h

Type: `string`

Define a customized filename using [Lo-Dash templates](https://lodash.com/docs#template).<br>
For example `<%= date %> - <%= url %>-<%= size %><%= crop %>`.
Define a customized filename using templating.<br>
For example `{{date}} - {{url}}-{{size}}{{crop}}`.

Available variables:

Expand Down
4 changes: 4 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ test('multiple URLs', t => {
t.true(pathExists.sync('temp/github.com-1000x1000.png'));
t.true(pathExists.sync('temp/google.com-1000x1000.png'));
});

test('`filename` option', t => {
t.true(pathExists.sync('temp/filename-option-sindresorhus.com.png'));
});

0 comments on commit ab861ad

Please sign in to comment.