MT adding /* MT [ sub: 1 ] */ above the first CSS line

This topic contains 6 replies, has 2 voices, and was last updated by  Sebastian 1 week, 5 days ago.

Author Posts

Sridhar

I have hand coded a bunch of CSS in MT and see that it has added

/* MT [ sub: 1 ] */

for every style block.

Screenshot: https://d.pr/i/dvT9w3

It’s not doing this for the selector that I added via the MT’s interface, only the ones I typed inside the left side code area.

May I know what this is for and if there’s a way to get rid of it?


Sebastian

Hey Sridhar,

So the little MT [ sub: 1 ] comments tell Microthemer that the extra CSS selectors you add belong to one MT UI selector, which you have named Everest form. MT allows multiple CSS selectors, but only the first selector syncs up with the UI fields, in that you can edit the CSS interchangeably via the editor or the fields. And the responsive tabs only auto-fill the first selector. So really, it is probably best to create a single UI selector for a single CSS selector – most of the time at least.

I could set the MT [ sub: 1 ] comment to be hidden (and just use it for internal purposes in the background). But when the UI CSS is also interchangeable with the full code CSS editor, the comment will need to be present in order to map the CSS to the UI consistently. As I mentioned in my reply earlier, this feature isn’t far off. And I felt it might be more consistent to always show the MT [ sub: 1 ] comment. I could be swayed though…

You will notice that MT also adds comments for Google fonts and animation events to ensure the raw CSS can be mapped back to the UI fields correctly. This pattern is necessary for interchangeability as far as I can tell.

I’m listening if you have strong feeling from a user perspective though.

Cheers,
Sebastian


Sridhar

Got it.

Is there a way to strip these in the generated CSS (View > Generated CSS & JS)?


Sebastian

Not currently.

In order to support that I would need to add an option to the preferences. This would need to be configurable because stripping the comments would come at the cost of being able to important the CSS file back to Microthemer without changing the structure of the selectors in the UI.

Do you want to strip these comments because it feels generally cleaner? Or some other reason? Either way, I am happy to add the configuration option if it is important to you.

Cheers,
Sebastian


Sebastian

Oh and you can strip all comments if you choose the minify CSS option. But of course minifying isn’t good if you may wish the edit the CSS code again outside of Microthemer.


Sridhar

There are online tools that I can use to unminify CSS. I think this can also be done using Chrome dev tools.

So let’s leave this as is for now.


Sebastian

OK cool.

You must login or register to reply to this topic.