From 2884107c11ec696f72ccd2f0dbdb9af314fdee74 Mon Sep 17 00:00:00 2001 From: Fabrice Weinberg Date: Fri, 20 Jun 2014 12:45:37 +0200 Subject: [PATCH] Fix #33, bump version to 0.2.5 --- README.md | 3 +++ package.json | 2 +- tasks/svgstore.js | 6 ++++-- test/expected/cutnameafterfirstdot.svg | 2 +- test/fixtures/naming/name.min.svg | 1 - 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2d4b256..3a956e2 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,9 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. ## Release History +#### 0.2.5 + * To generate the id from the filename is now used as a title. (Fix [#33](https://github.com/FWeinb/grunt-svgstore/issues/33)) + #### 0.2.4 * Added `options.symbol` to add attributes to generated ``s ([#30](https://github.com/FWeinb/grunt-svgstore/pull/30)) * To generate the id from the filename the name is now cut right before the first dot. `name.min.svg` becomes `name`. (Fixes [#29](https://github.com/FWeinb/grunt-svgstore/issues/29)) diff --git a/package.json b/package.json index b58b9c0..5f28130 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "grunt-svgstore", "description": "Merge SVGs from a folder.", - "version": "0.2.4", + "version": "0.2.5", "homepage": "https://github.com/FWeinb/grunt-svgstore", "author": { "name": "Fabrice Weinberg", diff --git a/tasks/svgstore.js b/tasks/svgstore.js index f6b7a24..21fbeda 100644 --- a/tasks/svgstore.js +++ b/tasks/svgstore.js @@ -135,8 +135,10 @@ module.exports = function (grunt) { $title.remove(); $desc.remove(); + var id = convertNameToId(filename); + // If there is no title use the filename - title = title || filename; + title = title || id; var resultStr = '' + '' + title + ''; @@ -150,7 +152,7 @@ module.exports = function (grunt) { $res('symbol').attr('viewBox', $svg.attr('viewBox')); - var graphicId = options.prefix + convertNameToId(filename); + var graphicId = options.prefix + id; // Add ID to the first Element $res('*').first().attr('id', graphicId); diff --git a/test/expected/cutnameafterfirstdot.svg b/test/expected/cutnameafterfirstdot.svg index 18e5bb0..1a82c4e 100644 --- a/test/expected/cutnameafterfirstdot.svg +++ b/test/expected/cutnameafterfirstdot.svg @@ -1,4 +1,4 @@ -Codepen IconThis is the offical Codepen icon nameThis is the offical Codepen icon - Codepen Icon This is the offical Codepen icon