Option to add CSS within <style> tags on current page

If I remember correctly, in early versions of Wappler, when using the Styles panel, CSS was added to the current page within style tags. Later this was changed and the CSS was added to style.css.

I can see this makes sense, and I expect most users were happy with this change. However, I would often prefer the CSS were added to the current page. Typically, I experiment with CSS before I'm happy with it, and it's easier to do this if it's on the current page, before (usually) moving it to an external stylesheet.

I think now, with the AI Assistant, it would be even more useful to have the option at least of adding the CSS to the current page - for the same reasons as mentioned above, but also to spot errors more easily. Here's an example.

I noticed a red asterisk I often use for forms were appearing like this: '\00a0*. It turns out the while adding some new CSS, the AI Assistant had done a little 'tidying up'. It had changed a class I often use:

.req::after {
    content: "\00a0*";
    color: red;
}

.. to

.req::after {
    content: "\\00a0*";
    color: red;
}

I asked why the change was made:

This was incorrectly changed. In CSS, the escape sequence for a Unicode character only needs one backslash, not two. The double backslash is actually escaping the backslash itself, which would prevent the Unicode character from being properly interpreted.

Of course, I can ask the assistant to add the CSS to the current page, not to an external stylesheet, but I sometimes forget (and the assistant seems to forget sometimes too).

I typically have a second screen to display the style sheet, which eliminates the need to transfer the styles from the page to the style sheet later.

That's a good idea, but I'd still like an option for CSS to be created on the current page. By the time I've got some CSS to work as as I want, transferring it manually to an external stylesheet is a minor concern. (CSS is not my strong point.)

Also, if the over-enthusiastic AI Assistant makes additional changes which I didn't request - and, as in my example above, causes errors - it would be easier to spot if changes were added within <style> tags.

1 Like