Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-svgstore

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-svgstore - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

test/expected/preserve_attribute.svg

24

Gruntfile.js

@@ -21,6 +21,6 @@ /*

'tasks/*.js',
'<%= nodeunit.tests %>',
'<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc',
jshintrc: '.jshintrc'
},

@@ -31,3 +31,3 @@ },

clean: {
tests: ['tmp'],
tests: ['tmp']
},

@@ -46,3 +46,3 @@

prefix: {
options:{
options: {
prefix: 'icon-'

@@ -56,3 +56,3 @@ },

svgattr: {
options:{
options: {
svg: {

@@ -136,3 +136,11 @@ viewBox : '0 0 100 100'

},
preserveattribute: {
options: {
cleanup: ['fill', 'stroke', 'imafake']
},
files: {
'tmp/preserve_attribute.svg': ['test/fixtures/preserve_attribute.svg']
}
},
cleanupwithinheritviewbox: {

@@ -259,4 +267,4 @@ options: {

nodeunit: {
tests: ['test/*_test.js'],
},
tests: ['test/*_test.js']
}

@@ -263,0 +271,0 @@ });

{
"name": "grunt-svgstore",
"description": "Merge SVGs from a folder.",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/FWeinb/grunt-svgstore",

@@ -6,0 +6,0 @@ "author": {

@@ -257,11 +257,15 @@ # grunt-svgstore [![NPM version](https://badge.fury.io/js/grunt-svgstore.svg)](http://badge.fury.io/js/grunt-svgstore) [![Build Status](https://travis-ci.org/FWeinb/grunt-svgstore.svg?branch=master)](https://travis-ci.org/FWeinb/grunt-svgstore)

#### 0.4.1
* Introducing the `preserve--` prefix for attributes to force these attributes in the result svg (See [#71](https://github.com/FWeinb/grunt-svgstore/pull/71))
#### 0.4.0
* Generate fixed sized reference based copies of symbols (See [#58](https://github.com/FWeinb/grunt-svgstore/pull/58))
* Add a way to inherit the viewbox form the source svg (See [#66](https://github.com/FWeinb/grunt-svgstore/pull/66))
* Expose `convertNameToId` option to customize how ids are derived from file names. (See [#68](https://github.com/FWeinb/grunt-svgstore/pull/68))
* Changed the way ids are generated by using the result of `convertNameToId` to prefix each id. (See [#50](https://github.com/FWeinb/grunt-svgstore/issues/50))
#### 0.3.6
* Preserve currentColor in `fill` attribute even if `cleanup` is set to `true. (See [#63](https://github.com/FWeinb/grunt-svgstore/pull/63))
* Preserve currentColor in `fill` attribute even if `cleanup` is set to `true`. (See [#63](https://github.com/FWeinb/grunt-svgstore/pull/63))

@@ -268,0 +272,0 @@ #### 0.3.5

@@ -146,3 +146,3 @@ /*

var value = attrs[key];
var id, match;
var id, match, preservedKey = '';

@@ -168,10 +168,32 @@ while ( (match = urlPattern.exec(value)) !== null){

if (key !== 'id') {
if (options.cleanupdefs || !$elem.parents('defs').length) {
if (cleanupAttributes.indexOf(key) > -1){
// Letting fill inherit the `currentColor` allows shared inline defs to
// be styled differently based on an xlink element's `color` so we leave these
if (!(key === 'fill' && $elem.attr('fill') === 'currentColor')) {
if (key.match(/preserve--/)) {
//Strip off the preserve--
preservedKey = key.substring(10);
}
if (cleanupAttributes.indexOf(key) > -1 || cleanupAttributes.indexOf(preservedKey) > -1){
if (preservedKey && preservedKey.length) {
//Add the new key preserving value
$elem.attr(preservedKey, $elem.attr(key));
//Remove the old preserve--foo key
$elem.removeAttr(key);
}
else if (!(key === 'fill' && $elem.attr('fill') === 'currentColor')) {
// Letting fill inherit the `currentColor` allows shared inline defs to
// be styled differently based on an xlink element's `color` so we leave these
$elem.removeAttr(key);
}
} else {
if (preservedKey && preservedKey.length) {
//Add the new key preserving value
$elem.attr(preservedKey, $elem.attr(key));
//Remove the old preserve--foo key
$elem.removeAttr(key);
}
}

@@ -178,0 +200,0 @@ }

@@ -174,2 +174,12 @@ 'use strict';

cleanup_preserve_leaves_attributes: function(test) {
test.expect(1);
var actual = grunt.file.read('tmp/preserve_attribute.svg');
var expected = grunt.file.read('test/expected/preserve_attribute.svg');
test.equal(actual, expected, 'attribute with value of preserve-- should strip preserve');
test.done();
},
cleanup_with_inheritviewbox: function(test) {

@@ -176,0 +186,0 @@ test.expect(1);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc