Code Monkey home page Code Monkey logo

modern-html5-boilerplate's Introduction

Modern HTML5 Boilerplate

In need of a simple landing pages or static websites? Then this extremely minimal Modern HTML5 Boilerplate might be just for you.

Features

  • Produces minified, static HTML files
  • Automatic JS/CSS minification, uglify, combine, compress and concat with Gulp
  • Stylesheet language: SCSS (libsass)
  • Flexible SCSS grid included: Jeet Grid
  • Responsive typography with viewport units
  • SCSS and PHP linting built-in

Installation

  1. git clone https://github.com/ronilaukkarinen/modern-html5-boilerplate yourprojectname
  2. If you add your project to git, remember to remove .git folder with rm -rf .git
  3. npm-check-updates -u to update Node.JS modules (you need npm-check-updates for this)
  4. npm install to install them
  5. Edit package.json and gulpfile.js and rename project name and author according to your new project
  6. gulp and start coding your static website (you might want to change meta tags and _config.scss variables first)

Start with src/sass/layout/_main.scss.

Have fun!

Alternative cache (with php)

Currently this produces static HTML pages via php2html, but you can disable gulp-php2html, gulp-htmlmin and enable semi-dynamic caching for your index.php, by adding this to dist/index.php:

<?php
// Settings
$cache = false;
$cache_lifetime_hours = 12;
$minifyhtml = true;
$cachefile = 'index.html';

// Minify HTML -function
function sanitize_output( $buffer ) {
  $search = array(
    '/\>[^\S ]+/s',     // strip whitespaces after tags, except space
    '/[^\S ]+\</s',     // strip whitespaces before tags, except space
    '/(\s)+/s',         // shorten multiple whitespace sequences
  );

  $replace = array(
    '>',
    '<',
    '\\1',
    '',
  );

  $buffer = preg_replace( $search, $replace, $buffer );
  return $buffer;
}

ob_start( 'sanitize_output' );

// Start cache tricks
if ( $cache === true ) :
  $cachetime = 3600 * $cache_lifetime_hours;
  if ( file_exists( $cachefile ) && time() - $cachetime < filemtime( $cachefile ) ) {
    echo '<!-- Amazing hand crafted super cache by rolle, generated ' . date( 'H:i', filemtime( $cachefile ) ) . ' -->';
    include( sanitize_output( $cachefile ) );
    exit;
  }
  ob_start();
endif;

// Content start
include('../src/index.php');

// End cache tricks
if ( $cache === true ) :
  $fp = fopen( $cachefile, 'w' );
  fwrite( $fp, sanitize_output( ob_get_contents() ) );
  fclose( $fp );
  ob_end_flush();
endif;

modern-html5-boilerplate's People

Contributors

dependabot[bot] avatar ronilaukkarinen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

modern-html5-boilerplate's Issues

No license

It's good to license your work, since it either allows or denies others using this. If no license is supplied, it automatically means this can not be used for an actual project.

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.