Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aloisdeniel/bluff
A static website generator in Dart.
https://github.com/aloisdeniel/bluff
dart generator html static-site
Last synced: 27 days ago
JSON representation
A static website generator in Dart.
- Host: GitHub
- URL: https://github.com/aloisdeniel/bluff
- Owner: aloisdeniel
- License: mit
- Created: 2020-01-02T19:43:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-29T12:19:50.000Z (almost 5 years ago)
- Last Synced: 2024-09-29T16:05:03.883Z (about 1 month ago)
- Topics: dart, generator, html, static-site
- Language: Dart
- Size: 106 KB
- Stars: 94
- Watchers: 8
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Bluff
## Diclaimer : I built this for my own needs, so don't expect it to be complete. It is a weekend hack, use at your own risk!
Bluff is a static website generator written in dart that is inspired by Flutter widgets.
> Why ?I started this project because I was tired of switching to a js environment everytime I need to write a small static website. I wanted the concept to be nearest of Flutter as possible, again, to keep the same way of developing user interfaces and not loosing time relearning paradigms again and again.
> Why not using Flutter for web ?
Just because I wanted a really lightweight website with good SEOs. The migration to Flutter for web should be pretty simple though.
## Usage
A simple usage example:
```dart
import 'package:bluff/bluff.dart';Future main() async {
final app = Application(
availableSizes: [
MediaSize.small,
MediaSize.medium,
],
supportedLocales: [
Locale('fr', 'FR'),
Locale('en', 'US'),
],
routes: [
homeRoute,
],
);
;await publish(app);
}final homeRoute = Route(
title: (context) {
final locale = Localizations.localeOf(context);
if (locale.languageCode == 'fr') return 'Accueil';
return 'Home';
},
relativeUrl: 'index',
builder: (context) => Home(),
);class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final theme = Theme.of(context);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Flex(
direction: mediaQuery.size == MediaSize.small
? Axis.vertical
: Axis.horizontal,
children: [
Expanded(
child: Container(
height: 300,
decoration: BoxDecoration(
image: DecorationImage(
image: ImageProvider.asset('images/logo_dart_192px.svg'),
),
),
),
),
Padding(
padding: EdgeInsets.all(20),
child: Text('Hello world!'),
),
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
color: const Color(0xFF0000FF),
borderRadius: BorderRadius.circular(5),
boxShadow: [
BoxShadow(
color: const Color(0xAA0000FF),
blurRadius: 10,
offset: Offset(10, 10),
),
],
),
),
Image.asset(
'images/logo_dart_192px.svg',
fit: BoxFit.cover,
),
Click(
newTab: true,
url: 'https://www.google.com',
builder: (context, state) {
return Container(
child: Text(
'Button',
style: theme.text.paragraph.merge(
TextStyle(
color: state == ClickState.hover
? const Color(0xFFFFFFFF)
: const Color(0xFF0000FF),
),
),
),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: state == ClickState.hover
? const Color(0xFF0000FF)
: const Color(0x440000FF),
borderRadius: BorderRadius.circular(5),
),
);
},
)
],
)
],
);
}
}```