Coder Social home page Coder Social logo

isabella232 / xhp-bootstrap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/xhp-bootstrap

0.0 0.0 0.0 303 KB

Provides classes to use with XHP for common components of Twitter's Bootstrap library.

Home Page: http://bootstrap.hhvm.com/

License: Other

Hack 99.95% CSS 0.05%

xhp-bootstrap's Introduction

XHP classes for the Bootstrap project

Project Status

We are not planning to actively maintain this project; however, we still believe it has value as an example.

XHP-Bootstrap was one of the first general-purpose UI libraries for XHP; feedback from our users has shown several problems that ultimately make us believe that general-purpose UI libraries are not a good fit for XHP:

  • Sites/applications should use semantic markup; Bootstrap should be an implementation detail, not something that every endpoint/controller is strongly tied to
  • Strict child validation is a valuable part of XHP; it's not possible to do take advantage of this in a general-purpose library. This can be partially worked around through heavy usage of categories, however that significantly weakens XHP's model
  • A similar problem exists for attributes, however there is no workaround; for example, many elements have an href attribute, which should take a string in a general purpose library - many sites will want to ban string hrefs, requiring a site-specific URI object instead. The only way to support this would be to type all attributes as mixed

We believe this project is still useful for reference when implementing your own elements. You may also find the HHVM documentation site's XHP elements useful as a real-world example.

Overview

The Bootstrap project is a popular HTML, CSS, and JS framework providing common components for web pages. This project provides XHP classes for these components.

Requirements

Getting Started

Step 1: Include Bootstrap Prerequisites

Bootstrap's JavaScript components require jQuery to be included, so either grab the downloadable version and reference it, or use a CDN and include it in the head of your XHP document:

<head>
  ...
  <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  ...
</head>

Step 2: Include Bootstrap Source

Grab the latest Bootstrap package and reference it, or use their CDN links and include them in the head of your XHP document:

<head>
  ...
  <!-- Latest compiled and minified CSS -->
  <link
    rel="stylesheet"
    href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
  />
  <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  <!-- Latest compiled and minified JavaScript -->
  <script
    src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"
  />
  ...
</head>

Step 3: Add XHP-bootstrap dependency

Add the following to your composer.json, then re-run composer:

  "minimum-stability": "dev",
  "require": {
    "hhvm/xhp-bootstrap": "dev-master"
  }

Step 4: Enable Composer Autoloading

If you haven't already, include the following in your PHP to enable autoloading from Composer:

  require_once('vendor/autoload.php');

Once you've done this you are ready to start using any of the XHP-Bootstrap classes in your project.

Class References and Examples

You can also browse the list of available XHP-Bootstrap classes with live examples at http://bootstrap.hhvm.com

You can also interact with these by configuring a webserver to look inside the example/ directory and accessing example.php.

Differences

In the Bootstrap documentation, a component's default/primary/success/info/warning/danger/link state (white/dark blue/green/light blue/orange/red/link) is referred to as use for some components, but color for others. XHP-Bootstrap uses the use attribute throughout for consistency.

License

XHP-Bootstrap is BSD-licensed. We also provide an additional patent grant.

Contributing

Please see CONTRIBUTING.md

xhp-bootstrap's People

Contributors

fredemmott avatar ptarjan avatar ckwalsh avatar andrekiu avatar sgolemon avatar swahvay avatar fpacifici avatar rob0rt avatar matthewjohnston4 avatar rdewilde avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.