Styling
Taxus supports SCSS for modern CSS authoring.
Styles Directory
SCSS files are stored in the styles/ directory:
styles/
└── main.scss
SCSS Compilation
The generator compiles SCSS to CSS during the build process:
- Read SCSS files from
styles/ - Compile to CSS using
grass - Write to
dist/css/
Example Stylesheet
styles/main.scss:
// Main stylesheet
// Variables
$primary-color: #0066cc;
$text-color: #333;
$background: #fff;
// Base styles
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
line-height: 1.6;
color: $text-color;
background: $background;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
// Headings
h1,
h2,
h3 {
margin-top: 1.5em;
color: darken($text-color, 10%);
}
// Links
a {
color: $primary-color;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
// Code blocks
pre {
background: #f4f4f4;
padding: 1rem;
border-radius: 4px;
overflow-x: auto;
}
code {
font-family: "Consolas", "Monaco", monospace;
font-size: 0.9em;
}
SCSS Features
Variables
$primary: #0066cc;
$spacing: 1rem;
.button {
background: $primary;
padding: $spacing;
}
Nesting
nav {
ul {
list-style: none;
}
li {
display: inline-block;
}
a {
color: $primary;
}
}
Partials
Split styles into multiple files:
styles/
├── main.scss # Main file
├── _variables.scss # Variables
├── _base.scss # Base styles
├── _nav.scss # Navigation
└── _footer.scss # Footer
Import in main file:
@use "variables";
@use "base";
@use "nav";
@use "footer";
Mixins
@mixin flex-center {
display: flex;
justify-content: center;
align-items: center;
}
.container {
@include flex-center;
}
Output
Compiled CSS is written to:
dist/
└── css/
└── main.css
Syntax Highlighting Styles
Taxus includes built-in themes for syntax highlighting. Import them in your main stylesheet:
// Light theme (GitHub-inspired)
@use "highlight-light";
// Or dark theme (Catppuccin-inspired)
@use "highlight-dark";
These themes style the hl-* classes generated by tree-sitter syntax highlighting. See Syntax Highlighting for the full list of highlight classes and customization options.
Linking Styles
Include the stylesheet in your template:
<link rel="stylesheet" href="/css/main.css" />
Development
For development, you can use the sass CLI for live compilation:
# Install sass
npm install -g sass
# Watch for changes
sass --watch styles/main.scss dist/css/main.css
Future Enhancements
Planned improvements for styling:
- PostCSS: Autoprefixer and other transformations
- CSS minification: Production-ready output
- Source maps: Debug support
- CSS modules: Scoped styles for components