blogger_theme 4.0.0 copy "blogger_theme: ^4.0.0" to clipboard
blogger_theme: ^4.0.0 copied to clipboard

retracted

A lightweight standalone Dart library to design Blogger themes with Jaspr-like syntax.

example/main.dart

import 'dart:io';

import 'package:blogger_theme/blogger_theme.dart';

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,
            ),
          ],
        ),
        BIf(
          cond: 'data:view.isPost',
          children: [
            Div(
              attributes: {'class': 'post-item'},
              children: [BData(value: 'post.body')],
            ),
          ],
        ),
      ],
    ),
  ];
}

void main() {
  final theme = BloggerTheme(
     attributes: {
      'b:responsive': 'true',
      'b:defaultwidgetversion': '2',
      'b:layoutsversion': '3',
      'b:css': 'false',
      'xmlns': 'http://www.w3.org/1999/xhtml',
      'xmlns:b': 'http://www.google.com/2005/gml/b',
      'xmlns:data': 'http://www.google.com/2005/gml/data',
      'xmlns:expr': 'http://www.google.com/2005/gml/expr',
    },
    // Reset attributes to clean XML output for strict AMP validation
    children: [
      BAttr(name: 'xmlns', value: ''),
      BAttr(name: 'xmlns:b', value: ''),
      BAttr(name: 'xmlns:expr', value: ''),
      BAttr(name: 'xmlns:data', value: ''),
      // Conditionally adds class="amp" to <html> when ?amp=1 is in the URL
      BClass(cond: 'data:view.url.params.amp == "1"', name: 'amp'),
    ],
    head: [
      Title(children: [Text('Generated Blogger Theme')]),
      BSkin('body { font-family: Arial, sans-serif; }'),
    ],
    body: [
      const BlogLayout(),
      // Optional: compile a local Dart client script into inline JavaScript.
      // const BClientScript('web/interactivity.dart'),
    ],
  );

  final xml = theme.generate();
  print(xml);

  final outputFile = File('build/blogger_theme.xml');
  outputFile.createSync(recursive: true);
  outputFile.writeAsStringSync(xml);

  print('Wrote generated theme to ${outputFile.path}');
}
1
likes
0
points
215
downloads

Documentation

Documentation

Publisher

verified publisherhireflutter.uk

Weekly Downloads

A lightweight standalone Dart library to design Blogger themes with Jaspr-like syntax.

Repository (GitHub)
View/report issues

Topics

#html-generation #web #templates #blogger

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

path, web

More

Packages that depend on blogger_theme