-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added removeDimensions to its own branch
- Loading branch information
1 parent
de073e9
commit 0a3ee55
Showing
7 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,4 @@ plugins: | |
- removeUnusedNS | ||
- transformsWithOnePath | ||
- sortAttrs | ||
- removeDimensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
exports.type = 'perItem'; | ||
|
||
exports.active = false; | ||
|
||
/** | ||
* Remove width/height attributes when a viewBox attribute is present. | ||
* | ||
* @example | ||
* <svg width="100" height="50" viewBox="0 0 100 50"> | ||
* ↓ | ||
* <svg viewBox="0 0 100 50"> | ||
* | ||
* @param {Object} item current iteration item | ||
* @return {Boolean} if true, with and height will be filtered out | ||
* | ||
* @author Benny Schudel | ||
*/ | ||
exports.fn = function(item) { | ||
|
||
if ( | ||
item.isElem('svg') && | ||
item.hasAttr('viewBox') | ||
) { | ||
item.removeAttr('width'); | ||
item.removeAttr('height'); | ||
} | ||
|
||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.