Back-end Integration

Headstart wasn't initially made with back-end integration in mind. Nonetheless, some things can be moved around and configured to make it possible.

Laravel Integration

The following steps have been used to port the Headstart website to Laravel. It is available under MIT at Github if you would like to take a look at the files.

First, move your project files into a private folder within the Laravel setup, and the .html extensions should be changed to .blade.php.

Then config.json needs to be edited (read up on the options in the Structure section) as following:

"export_assets": "../public",
"export_templates": "../app/views",
"export_misc": "../public",
"assemble_templates": false,
"template_asset_prefix": "{{URL::to('/')}}",

With these settings, Headstart will build the assets folder and misc folder contents to the public folder. It will also move the views over to app/views without compiling to let the Blade engine handle them. All assets will also be prefixed with some Blade syntax to give them absolute paths, rather than relative ones.

Since references to scripts and stylesheets get injected, the location markers have to be put inside of the main content files. This part from header.blade.php:

<!-- inject:css --><!-- endinject -->


And this part fromfooter.blade.php:

<!-- inject:js --><!-- endinject -->

Need to be moved to all your indiviual pages. It isn't pretty, but it works. Example index.blade.php:

<!-- inject:js --><!-- endinject -->

Your page content ...

<!-- inject:js --><!-- endinject -->

If you really don't like this solution and you don't plan on having view-specific assets, you can also move the parts into their own blades (in the root of templates!), eg. top-inject.blade.php and bottom-inject.blade.php and import those back into the layout parts where you extracted them from. Still ugly, but at least it makes your other content Blades less messy.

Note: Assets will not be imported in Blades located in subfolders. The solution mentioned above (having inject blades) works, but, again, will not support page-specific assets. This has been marked as an enhancement on Github Issues.

Other Integrations

If you have succesfully integrated Headstart into any kind of other back-end system not mentioned on this page, I would be much obliged if you could share your process with me so it can be included here. Various ways of contacting me can be found on my website.