Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.09 KB

styling.md

File metadata and controls

38 lines (25 loc) · 1.09 KB

Styling

Introduction

This document provides an overview of the styling mechanism in the Singularity framework. It explains how to use the inlineImport function to include CSS files in your application.

Table of Contents

Using the inlineImport function for CSS

The inlineImport function can be used to import CSS files that will be included in the final HTML page as inline style tags. This helps in keeping the styles modular and scoped to specific components.

Example:

{inlineImport({ src: "counter.css" })}
Component content

The CSS file will be included once per render and will not be hydrated by the client, as it does not have any interactivity.

Scoped Styling

The imported CSS files are not CSS modules, so you need to use normal CSS syntax techniques like nesting for scoping. This ensures that the styles are applied only to the intended elements.

Example:

.counter {
  p {
    color: red;
    /* this will be a scoped style */
  }
}