lapalabs/skeleton-bundle

The HTML markup skeleton of base templates for Symfony Framework

Installs: 115

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Language:HTML

v0.0.1 2015-03-09 20:09 UTC

This package is auto-updated.

Last update: 2024-04-29 03:24:00 UTC


README

The HTML markup skeleton of base templates for Symfony Framework

SensioLabsInsight

Install

Install bundle with Composer dependency manager first by running the command:

$ composer require "lapalabs/skeleton-bundle:dev-master"

Composer will install the bundle to your project's vendor directory.

Include

Including the bundle to your Symfony project is as easy as to do a few simple steps.

  1. Enable the bundle in application kernel for prod environment:
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // other bundles...
        new LapaLabs\SkeletonBundle\LapaLabsSkeletonBundle(),
    );
}
  1. Register the bundle's routes for dev environment (optional, if you want to see demo examples):
# app/config/routing_dev.yml
_lapalabs_skeleton_bundle:
    resource: "@LapaLabsSkeletonBundle/Controller/"
    type:     annotation
    prefix:   /_lapalabs/skeleton

Usage

The best practices is to create your own template, that extends skeleton one. For example, create your own layout.html.twig in AppBundle:

{# src/AppBundle/Resources/views/layout.html.twig #}

{% extends 'LapaLabsSkeletonBundle:html5:layout.html.twig' %}

{% block css %}
    {{ parent() }} {# if you want to include content of parent block #}
    <link rel="stylesheet" href="{{ asset('bower_components/bootstrap/dist/css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('bower_components/bootstrap/dist/css/bootstrap-theme.min.css') }}">
{% endblock %}

{% block js %}
    <script src="{{ asset('bower_components/jquery/dist/jquery.min.js') }}"></script>
{% endblock %}

And then you can extends it in other templates:

{# src/AppBundle/Resources/views/Post/show.html.twig #}

{% extends 'AppBundle::layout.html.twig' %}

{% block content_wrap %}
    <h1>{{ entity.heading }}</h1>
    <p>{{ entity.description }}</p>
{% endblock %}

Congratulations!

You're ready to rock your templates to extends skeleton templates!

More documentation: