mirror of
https://github.com/svg/svgo.git
synced 2025-07-31 07:44:22 +03:00
Prefix ids plugin don't add prefix if prefix is false (#907)
Add to 'prefixIds' the option to pass prefix as false or as a function that returns false
This commit is contained in:
committed by
Lev Solntsev
parent
ece039ed8a
commit
0a142f3ca0
@ -123,6 +123,8 @@ exports.fn = function(node, opts, extra) {
|
||||
} else {
|
||||
prefix = opts.prefix;
|
||||
}
|
||||
} else if (opts.prefix === false) {
|
||||
prefix = false;
|
||||
} else if (extra && extra.path && extra.path.length > 0) {
|
||||
var filename = path.basename(extra.path);
|
||||
prefix = filename;
|
||||
@ -131,6 +133,9 @@ exports.fn = function(node, opts, extra) {
|
||||
|
||||
// prefixes a normal value
|
||||
addPrefix = function(name) {
|
||||
if(prefix === false){
|
||||
return escapeIdentifierName(name);
|
||||
}
|
||||
return escapeIdentifierName(prefix + opts.delim + name);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user