Jump to content
You must now use your email address to sign in [click for more info] ×

monacotoni

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by monacotoni

  1. I'm using svgo and a custom plugin for this purpose. In Affinity Designer I add layer names like "myid", if I only want an id, I use "myid.myclass", in case I want both, and ".myclass" in case the class is sufficient. That's the plugin: fn: function (item) { if (item.isElem() && item.hasAttr('id')) { var id = item.attr('id').value.split('.'); if (id.length>1) { item.addAttr({ name: 'class', value: id[1], prefix: '', local: 'class' }) item.removeAttr('id') if (id[0] && id[0] !== '') item.addAttr({ name: 'id', value: id[0], prefix: '', local: 'id' }); } } } For my use case that's sufficient, but you could easily enhance it to allow multiple classes, etc. P.s.: to use it, you also have to disable "cleanupIDs" plugin in svgo config.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.