2017 © Pedro Peláez
 

project microframework

a lightweight framework designed for prototyping

image

hce/microframework

a lightweight framework designed for prototyping

  • Friday, November 10, 2017
  • by MarcoBoffo
  • Repository
  • 5 Watchers
  • 3 Stars
  • 28 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 27 Versions
  • 0 % Grown

The README.md

it.hce.microframework

a lightweight framework designed for prototyping, (*1)

Install

  • php composer.phar create-project hce/microframework projectName

or, (*2)

  • composer.phar create-project hce/microframework projectName

then, (*3)

  • cd projectName
  • npm install
  • Point your webserver to projectName/public folder
  • Set public/css and public/js as writable folders (create them if necessary)
  • Set cache as writable folder

Create a component

  • Create a folder under components named as you wish, for example component, (*4)

  • Create a component template: template.blade.php, (*5)

<div class="component">{{$component->text}}</div>
  • Style it with a new file called _style.scss, add this entry to resources/css/main.scss
.component {
    color: red;
}
  • Make it dynamic with script.js
App.Component = function () ...
  • Create a datasets folder and place a default.json file
{
  "text": "it.hce.microframework"
}

Create a template

  • Create a template file under templates, for example: homepage.blade.php
<!DOCTYPE html>
<html>
<head>
    <title>hce microframework</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="{{$GLOBAL->css}}">
    <link href='https://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
</head>
<body class="home">

@include('components.logo.template')


</body>
</html>

Combine components inside templates

  • Create a folder under public for your route, example: homepage
  • Create a .json file called homepage.json inside that folder
{
  "templateName": "homepage",
  "components": [
    {
      "name": "logo",
      "componentName": "logo",
      "dataSet": "default"
    },
    {
      "name": "subLogo",
      "componentName": "subLogo",
      "dataSet": "sub"
    }
  ]
}

name will be the internal name of the component componentName is the component's directory name in the filesystem dataSet is the loadding model, (*6)

You can load a component more that once, just give it a different name, (*7)

The JSON should follow this Schema:, (*8)

{
  "type": "object",
  "properties": {
    "templateName": {
      "type": "string",
      "default": "homepage",
      "required": true
    },
    "components": {
      "type": "array",
      "required": true,
      "items": [
        {
          "type": "object",
          "required": true,
          "properties": {
            "name": {
              "type": "string",
              "required": true
            },
            "componentName": {
              "type": "string",
              "required": true
            },
            "dataSet": {
              "type": "string",
              "required": true,
              "default": "default"
            }
          }
        }
      ]
    }
  }
}

See results

  • Run gulp
  • Go to your webserver http://www.your.host/homepage/homepage

Features

  • Compile Sass on the fly

Add any entry to resources/css/main.scss and let PHP compile and minify it for you. Create a main.scss.lock to bypass this., (*9)

In order to boost your sass compiling performance please refer to: sassphp., (*10)

  • Compile JS on the fly

All your components' JS and the list located at config/javascripts.json will be compiled under a unique main.js file. Create a main.js.lock to bypass this., (*11)

  • Icon support

Save your SVG icons under resources/svg and they will be parsed by the icons factory. Include them using @include inline-svg($icon-name) in any scss file., (*12)

  • All your common resources in one folder

Place audio, video, css, fonts, images, js, svgs in the resources folder, with gulp everything will be smartly copied in public, (*13)

  • Blade Support

The whole template engine is powered by Blade The components also use that engine to work, (*14)

  • Native responsive images support

add the following code to the blade template: @responsiveImage(['image' => $component->image, 'component' => 'componentName', 'attributes' => 'class="" alt="'.$component->articleTitle.'"'])the system will insert a tag with the image path, and create the appropriate srcset attribute according to the component's configuration. Responsive images can be created with the build-images Gulp task, based on a source image in the resoursces/images/scalable/componentName directory., (*15)

HCE Microframework Static Output

Usage

Compile the whole project as static output, (*16)

php static-output.php and gulp;, (*17)

cd static, (*18)

Install the http-server (provided by node), (*19)

npm install http-server -g, (*20)

Run the server, (*21)

http-server, (*22)

Open your browser@ localhost:8080, (*23)

The Versions

10/11 2017

dev-master

9999999-dev

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

10/11 2017

1.5.0

1.5.0.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

08/02 2017

1.4.1

1.4.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

22/11 2016

1.4.0

1.4.0.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

26/10 2016

1.3.1

1.3.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

25/10 2016

1.3.0

1.3.0.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

18/10 2016

1.2.2

1.2.2.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

18/10 2016

1.2.1

1.2.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

18/10 2016

1.2.0

1.2.0.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

04/08 2016

1.1.3

1.1.3.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

01/08 2016

1.1.2

1.1.2.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

01/08 2016

1.1.1

1.1.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

01/08 2016

1.1.0.x-dev

1.1.0.9999999-dev

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

27/07 2016

0.1.x-dev

0.1.9999999.9999999-dev

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo
by Paolo Mioni

27/07 2016

0.1.4

0.1.4.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo
by Paolo Mioni

26/07 2016

1.0.0

1.0.0.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

22/07 2016

0.1.2

0.1.2.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

22/07 2016

0.1.1

0.1.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

22/07 2016

0.0.9

0.0.9.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

23/03 2016

0.0.8

0.0.8.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

04/02 2016

0.0.7

0.0.7.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

18/01 2016

0.0.6

0.0.6.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

15/01 2016

0.0.5

0.0.5.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

15/01 2016

0.0.4

0.0.4.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

15/01 2016

0.0.3

0.0.3.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

15/01 2016

0.0.2

0.0.2.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo

15/01 2016

0.0.1

0.0.1.0

a lightweight framework designed for prototyping

  Sources   Download

proprietary

The Requires

 

by Marco Gatto Boffo