blogger_theme 3.0.0-alpha.1
blogger_theme: ^3.0.0-alpha.1 copied to clipboard
A lightweight standalone Dart library to design Blogger themes with Jaspr-like syntax.
π blogger_theme #
Declarative Blogger Theme Design in Dart. #
blogger_theme is a lightweight, standalone library that lets you build structured Blogger (Blogspot) themes using a clean, Jaspr-inspired component syntax. Stop wrestling with raw XML and start building themes with the power of Dart.
Note: This library renders your component tree directly into XML. It is not an AST-based parser or transformer.
Caution: This package is currently in alpha, and some features are still experimental.
π Features #
- β¨ Jaspr-inspired Syntax: Build your theme structure using declarative Dart components (
Component,DomComponent,Text). - π‘οΈ XML-Safe Rendering: Automatic escaping for
&, <, >, ", 'and sanitization of XML 1.0 control characters. - π Zero Dependencies: Pure Dart implementationβno heavy browser runtime or UI shells required.
- π¦ Blogger Native: Pre-built wrappers for standard tags like
<b:section>,<b:widget>,<b:loop>, and<b:if>. - β‘ Script Compiler: Compile your Dart logic directly into JavaScript and inject it into your Blogger layouts seamlessly.
π Resources #
- Official Documentation β Get up to speed on Blogger architecture.
- Video Tutorials β Step-by-step guides on our YouTube channel.
π Quick Start #
Add the package to your pubspec.yaml:
dependencies:
blogger_theme: ^3.0.0-alpha.1
Note: Because this package uses Dart primary constructors while the feature is still experimental, add the following to your
analysis_options.yamluntil the feature reaches stable release:analyzer: enable-experiment: - primary-constructors
1. Build your Layout #
Create reusable components that map to Blogger elements:
class BlogLayout extends Component {
const BlogLayout();
@override
Iterable<Component> build() => [
Div(
attributes: {'class': 'wrapper-pane'},
children: [
BSection(
id: 'header-area',
className: 'header-section',
maxwidgets: 1,
showaddelement: true,
children: [
BWidget(
id: 'Header1',
type: 'Header',
title: 'Blog Header Title',
locked: true,
),
],
),
],
),
];
}
2. Generate XML #
Assemble your theme and export it:
void main() {
final theme = BloggerTheme(
attributes: {'b:responsive': 'true'},
head: [
Title(children: [Text('My Custom Theme')]),
BSkin('body { background: #f4f4f4; }'),
],
body: [const BlogLayout()],
);
print(theme.generate());
}
π Project Structure #
src/
βββ core.dart # Core contracts & renderer
βββ blogger_components.dart # Blogger tag wrappers
βββ html_components.dart # HTML element helpers
βββ client_script.dart # Dart-to-JS compilation
βββ theme_utility.dart # Root generator
π€ Support & Contribution #
- Found a bug? Open an issue.
- Love the library? Consider sponsoring us.
- License: Licensed under MIT.