Hello, is there an option that we can make comment on the code editor?

This topic contains 8 replies, has 3 voices, and was last updated by  Sebastian 3 months, 2 weeks ago.

Author Posts

1101blueli

I write those css code all the time. But the comment will disappear when switching selector.

Like the one on line 44
https://ibb.co/2cLzgmt

Wondering is there a option we leave /*comment*/ on the editor?
Thanks


Sebastian

Hey,

The single selector editor has some limitations when it comes to comments. If comments are important, you need to add code via View > Full code editor > CSS.

Once version 7 is out, I will start work on CSS snippets, which can be added to the folders (like single selectors currently can). And they will integrate with the responsive tabs in the same way too.

Cheers,
Sebastian


1101blueli

Alright, I see!
Not really that important. Just curios.
Looking forward to the new version~

Thanks


1101blueli

Oh, I suddenly found that we can leave a comment within the bracket {}
https://ibb.co/JtVhHpK

Kind of a solution.


Sebastian

I just did a test, and MT stripped out the comments. So this may not be a workaround you can rely on.

When entering multiple selectors in the code editor, the comments should always stay for all selectors other than the first selector. Only the first selector syncs with the UI fields, the others don’t, and so the custom comment stays. I’m not sure why your body comment wasn’t stripped out. There must be some other factor at play, but just wanted to gives you a head up that it won’t always work.

Cheers,
Sebastian


metoki

May I ask if there is any news on this topic? I am looking for a way to break down my stylesheet into smaller chunks, and the Single Selector Editor with its folder structure looked like the perfect solution. However, after some time I realized that not only all spacings are removed from my CSS code but also all comments which is kind of a dealbreaker for me.

Cheers,
Martin


Sebastian

No news yet I’m afraid Martin. But a potential workaround could be to enable Sass via:

Settings > General > Preferences > CSS AND SASS > Enable Sass (at cost of syncing editor with UI fields)

You may not need Sass, but when it’s on Microthemer does not sync the text editor with the UI fields, which is why comments get stripped out. It just leaves your code as is. So you can write something like the following without losing comments:

.my-selector {
	color: red;
	// My Sass comment
	font-size: 16px;
	/* My regular CSS comment */
	padding: 2em;
}

Notice that you can also use // for single line Sass comments, which is more convenient. And you can use Sass too of course.

Note however, if this is an existing setup any styles that are supported via the UI will only be editable via input fields once you switch Sass support on (they won’t display in the editor).

Does that help at all?

Cheers,
Sebastian


metoki

Hi Sebastian,

thank you for your answer. This looks like the perfect workaround for me since I don’t use the UI fields anyway.

Cheers,
Martin


Sebastian

Oh great, thanks for confirming 🙂

You must login or register to reply to this topic.