It's great that you've decided to checkout Kayzen! How you go about buildig your next project with it depends on many things such as your prefered workflow, your skill level, amount of time you have etc. This page will cover the basics of all the different ways Kayzen can be adapted to suit any need. It is assumed that you have at least basic HTML, CSS and JavaScript/jQuery understanding.
To start from the bottom up, Kayzen is built using HTML5, CSS3 and jQuery. At the bare minimum, each Kayzen wepage should be served the following JavaScript and CSS assets:
The only files that would ever need to be modified are app.js and app.css. The other files (jQuery and pseudojQuery) are JavaScript libraries which can be left untouched. Read more about pseudojQuery here.
Kayzen comes with further JavaScript and CSS files which are only used for certain pages, these will be covered later. If you're desired workflow is to directly work on these files without touching the source files they are generated from (i.e. you are not comfortable with pre-processing and concatening), a lot of this documentation may not apply to you, and you will lose out on many of the fantastic features Kayzen has to offer.
If you are not yet familiar with Sass/SCSS or CSS pre-processing, checkout this article to understand the basis about what it is and why it's beneficial. Once you've decided to make the leap, you can read about how to setup your workflow to include Sass by reading this article.
At this stage, it is not essential to know about JavaScript concatenation. As long as you are comfortable using Sass you will gain most of the benefits Kayzen has to offer. Having said that, if you are comfortable combining JavaScript files, then continue reading, otherwise head over to the configure section
Both the default provided app.js
and app.css
contain code from several third party libraries and plugins. The files for these libraries and plugins reside in the assets/vendor folder, and include the following:
You will notice that all of the used third party resources exist on Github, and as such are included as Git Submodules. If you have purchased a license for Kayzen, you are entitled to access to the private Github repository located here. If you do not already have access, get in touch with us to gain access.
To clone Kayzen from the official repository and all of its submodules, run the following code on your command line in the directory you wish Kayzen to be cloned into:
git clone https://github.com/esr360/Kayzen.git --recursive
If you are using Node, you can run npm install
to allow you to use Grunt to build Kayzen from the source files. Once installed, you should first run grunt setup
to run the initial setup tasks (learn more). After running npm install
you should now have the following Node modules in the node_modules directory:
One of the tasks provided in Gruntfile.js
generates HTML pages from PHP templates. For this to function, php-cgi must be installed.
The php-cgi
binary can be installed via Homebrew by tapping the homebrew-php repository:
brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php brew install php56
The php-cgi
binary can be installed via XAMPP. Here is how you can add the binary to your PATH: Link
sudo apt-get install php5-cgi
One of the tasks provided in Gruntfile.js
creates small
and tall
variants of some images. For this to function, GraphicsMagick is required.
If you're a Mac user and have Homebrew installed, run:
brew install GraphicsMagick
Otherwise, visit the GraphicsMagick downloads page.
If you are using another build tool or want to build Kayzen manually, here are the key things it should encompass to successfully build Kayzen:
The app/scripts/app.js file contains the following third party JavaScript files:
The other files which are includes in app.js are:
Some pages use certain JavaScript files on an opt-in basis, and as such these files are not part of app.js and will need to be copied over into the app directory (app/scripts). These files include:
To reiterate, the above files should be copied (duplicated) into app/scripts.
The app/styles/app.css file contains the following third party stylesheet files, which are all impored at the top of assets/app.scss by default:
Some pages use certain CSS files on an opt-in basis, and as such these files are not part of app.css and will need to be copied over into the app directory (app/styles). These files include:
To reiterate, the above files should be copied (duplicated) into app/styles.
Kayzen uses PostCSS in order to use Autoprefixer. It does not use Compass or any other Sass libraries to handle vendor prefixing, so ensure your build process involves Autoprefixer with the following browser support options:
Kayzen requires a minimum Sass version of 3.4, so ensure that your Sass compiler is upto date with at least this version.
The images in the assets directory need to be copied (duplicated) into the app directory (app/images). This allows you to keep your source image files separate from your production ones, which may be compressed during your build process. These are located in the assets directory:
The default HTML templates will look for small
and tall
variants of the hero images provided in the demo
sub-directory of /images
. This point will likely be rendered moot as you add your own images.
The FontAwesome font files need to be copied (duplicated) into the app directory (app/fonts). These are located here:
The Enlighter plugin which is used by the Kayzen demo pages requires MooTools. MooTools requires you to build the file manually. Details on how to do so can be found on the MooTools repository page. Once you have built the file, it should now be available at assets/vendor/MooTools-Core/build/mootools-core.js. This file should then be copied to Kayzen's app directory (app/scripts).
One particular submodule (normalize-scss) requires the support-for library to be present within its own directory, and does not come by default as a result of installing normalize-scss. To clarify, the file located at assets/vendor/support-for/sass/_support-for.scss must be present within the assets/vendor/normalize-scss/sass/ directory when Sass compiles, otherwise it will throw an error. If you maually copy the file over, Git will complain that you have made changes to the normalize-scss submodule, so it is recommended that your build process involves copying the file over before Sass compiles, and then deleting it once the CSS has been compiled.
Kayzen is structured in a modular way, which makes things easier for everyone. Kayzen is built using the Synergy Sass Framework. As well as global configuration each module can be individually configured, giving you complete control and flexibility when customizing them for your project. This will also make updating your project in the future easier when new modules or module updates for Kayzen come out.
Every module is imported in the main app.scss file:
This is the root file for your project. As well as importing all the Sass modules it is also used to set which theme your project should use (more on this later), the path to your assets, and the option to output all the configuration to JSON to allow it to be accessed in your project's JavaScript (again, more on this later).
In terms of the Kayzen modules that are imported, for the most part importing the file will not output any code, it merely gives your codebase the ability to include it should you so desire. This is to allow you to create different themes which may or may not use all avilable modules. Any modules your theme doesn't use won't get output in the compiled CSS.
Themes are located in the themes directory. Each theme comes with a .scss file and a .js file. Kayzen provides several themes for you to choose from:
To set which theme your project should use, set the $theme
variable at the top of app.scss. By default this is set to Kayzen
.
You can now control every configurable aspect of your project from assets/themes/Kayzen/_kayzen.scss
. This file is where all the modules which are used by the theme are included, and also where you can pass any custom options to them. There are three types of modules, for a list of all of them and their available options, see the following links:
You can pass a custom option to a module in your theme's file (e.g. assets/themes/Kayzen/_kayzen.scss) like so:
@include accordions(( 'section-margin' : 1.4em, 'title-radius' : 0.4em, 'title-active-radius' : 0.4em 0.4em 0 0, 'content-radius' : 0 0 0.4em 0.4em ));
If the module you are editing has nestable options, you would change them like so:
@include palettes(( 'brand': ( 'primary' : #61BD6D, 'secondary' : #00A885 ), 'validation': ( 'valid' : MediumSeaGreen ) ));
To get started quickly, some of the most common modules you might want to configure might include:
Once you have configured all of your desired opions, you can preview all the modules on the Cheatsheet page.
Once you have configured all of your modules, you're ready to sart building your pages. Kayzen comes with numerous templates ready-made for you to use for your pages, you can view them here. New templates are added all the time, so be sure to regularly check for updates.
To edit the various features of the provided HTML templates, see the following sections.
A sticky header will become fixed as it's scroll position reaches the top of the browser window.
Locate app-header
module in your HTML file. It should look something like:
<header class="app-header" id="app-header"> ... </header>
It may have one or more modifiers, and if so will look something like:
<header class="app-header-bar-absolute" id="app-header"> ... </header>
To achieve a sticky header, add the sticky
modifier by adding -sticky
to the header's class, like so:
<header class="app-header-sticky" id="app-header"> ... </header>
<header class="app-header-absolute-sticky-bar" id="app-header"> ... </header>
A fixed top-bar will remain in a fixed position on screen.
Locate top-bar
module in your HTML file. It should look something like:
<div class="top-bar"> ... </div>
To achieve a fixed top-bar, add the fixed
modifier by adding -fixed
to the top-bar's class, like so:
<div class="top-bar-fixed"> ... </div>
In app/scripts/app.js
(or app/YOURTHEME/scripts/app.js
), locate the following code:
$(_footer).footer();
Reaplce with the following code, replacing your desired Twitter username to show tweets from:
$(_footer).footer({ twitterFeed : { username : 'esr360' } });
To change the google map colors, locate the following code in app/scripts/app.js
(or app/YOURTHEME/scripts/app.js
):
$('#google-map').googleMap();
Grab your desired styles array (e.g. https://snazzymaps.com/style/35/avocado-world) and pass it to the styles
option:
$('#google-map').googleMap({ styles: [...] });
Any page which uses the social share widgets (widgets which show how many shares a page has) will have the following JavasScript included on the page:
$(document).ready(function() { $.fn.KayzenSocialShareCount(); });
By default, the current page that the script is loaded on will be used to get the share information, but should you decide to use a different url, you can pass it as an option like so:
$(document).ready(function() { $.fn.KayzenSocialShareCount({ url : 'http://themeforest.net' }); });
To add a parallax effect to the billboard background, you can add the data-stellar-background-ratio
data attribute to activate the Stellar jQuery plugin.
<section class="billboard-overlay-full-screen" data-stellar-background-ratio="0.5"> ... </section>
To add a faded parallax effect to the billboard content (as opposed to the background), structure your billboard's HTML like so:
<section class="billboard-full-screen"> <div class="billboard_wrapper container"> <div class="billboard_content" id="billboard-fade-parallax"> ... </div> </div> </section>
The key to achieving the effect is the billboard-fade-parallax
id on your billboard's content element.
You can easily change the number of columns for any of the provided portfolio/blog templates by changing the span-x
class of the respective items. Kayzen uses a 12 column grid system, so for example, to change a 3 column layout where the items will have a class of span-4
to a 4 column layout, you would change the class for each item to span-3
.
To create columns with masonry items, you can either use one of the provided templates, or you can convert a non-masonry template into one by doing the following:
Load app/scripts/isotope.pkgd.js at the bottom of the page right underneath all other scripts:
... <script src="../app/scripts/app.js"> <script src="../app/scripts/isotope.pkgd.js">
Finally you need to call the loaded plugin on the relevant container, ensuring the code is inside a document.ready
function, and window.load
function:
<script> $(document).ready(function() { $(window).load(function() { $('#blog-items').isotope(); }); }); </script>
Where #blog-items
is the direct container of your portfolio/blog items.
To create a set of filterable items, you can either use one of the provided templates, or you can convert a non-filterable template into one by doing the following:
Load app/scripts/isotope.pkgd.js at the bottom of the page right underneath all other scripts:
... <script src="../app/scripts/app.js"> <script src="../app/scripts/isotope.pkgd.js">
Add the following code wherever you want the filter navigation to appear, changing id="blog-types"
to whatever you desire and swapping out the example filter attributes for your own:
<ul class="tabs_nav-pills" id="blog-types"> <li class="button-pill-grey-1-thin active" data-filter="*">View All</li> <li class="button-pill-grey-1-thin" data-filter="[data-image]">Image</li> <li class="button-pill-grey-1-thin" data-filter="[data-carousel]">Carousel</li> <li class="button-pill-grey-1-thin" data-filter="[data-vimeo], [data-youtube]">Video</li> <li class="button-pill-grey-1-thin" data-filter="[data-audio]">Audio</li> </ul>
Finally you need to call the loaded plugin on the relevant container, ensuring the code is inside a document.ready
function, and window.load
function:
<script> $(document).ready(function() { $(window).load(function() { $('#blog-items').isotope(); $('#blog-types').on('click', 'li', function() { var filterValue = $(this).attr('data-filter'); $('#blog-items').isotope({ filter: filterValue }); }); }); }); </script>
Where #blog-items
is the direct container of your portfolio/blog items, and #blog-items
is the container for your filter navigation items.
To create a set of infinitely-scrollable items, you can either use one of the provided templates, or you can convert a non infinite-scroll template into one by doing the following:
Load app/scripts/jquery-ias.js at the bottom of the page right underneath all other scripts:
... <script src="../app/scripts/app.js"> <script src="../app/scripts/jquery-ias.js">
For each set of 'loaded' content, there needs to be a separate HTML file with the content for the infinite scroll page to fetch the next set of items from. You can duplicate the first page and just update the pagination link as appropriate. The plugin will by default look for an element with an id of pagination
to get the next page to pull the content from.
<ul id="pagination"> <li class="next"><a href="3-cols-infinite-scroll-2.html">2</a></li> </ul>
You then need to call the loaded plugin on the relevant container, ensuring the code is inside a document.ready
function:
<script> $(document).ready(function() { $("#blog-items").KayenInfiniteScroll({ isotopeGrid : false }); }); </script>
Where #blog-items
is the direct container for your portfolio/blog items.
If you are calling other functions on your portfolio items, perhaps a carousel function, you will need to pass it to the infinite-scroll plugin so it can be re-called on the newly loaded items. This can be done like so:
<script> $(document).ready(function() { function articlesCarousel() { ... } articlesCarousel(); $("#blog-items").KayenInfiniteScroll({ isotopeGrid : false }, articlesCarousel); }); </script>
The Kayzen demo pages are genrated from custom PHP source files. You are completely free to utilise these PHP templates for your own use. Whilst the PHP framework Kayzen is built from is extremely basic, it allows you to rapidly prototype pages using all the various components Kayzen has to offer. All the PHP templates are located in the templates directory.
The core configuration file for the PHP templates can be found at templates/app.php. This is where all configurable templates are imported and all global constants are set, which include the following:
Constant | Default Value | Description |
---|---|---|
theme |
'Kayzen' |
Set which theme's assets you would like to load. |
realm |
'demo' |
Can either be demo or live , currently only used to serve placeholder images instead of stock photos. |
env |
dev |
Can be either dev or prod . If prod , the code will look for minified (.min.*) assets. |
path |
'server' |
Can either be static ,server or explorer , and defines how asset paths should be loaded. |
themes |
false |
If enabled, templates will look to assets nested inside a self-named directory, e.g. app/themes/Kayzen/scripts/app.js. |
The below includes can be used on any page which includes the app.php file, and will output some code depending on the options you pass to the function. They are located in the templates/includes directory.
You can use any of the above functions in yout PHP/PHTML pages like so:
articleItem();
You can pass custom options to the function like so:
articleItem(array( 'media' => 'carousel', 'size' => 'small', 'span' => 4 ));
The below modules can be used on any page which includes the app.php file, and will output some code depending on the options you pass to the function. They are located in the templates/modules directory.
You can use any of the above functions in yout PHP/PHTML pages like so:
billboard();
You can pass custom options to the function like so:
billboard([ 'title' => [ 'text' => 'My Title' ], 'tag-line' => 'My Tagline' ]);
The below sections can be used on any page which includes the app.php file, and will output some code depending on the options you pass to the function. They are located in the templates/sections directory.
You can use any of the above functions in yout PHP/PHTML pages like so:
clients();
You can pass custom options to the function like so:
clients(array( 'title' => 'Popular Brands', 'sub-title' => 'Get The Best Deals' ));
Several things are required to create a PHP page using Kayzen. Below shows the minimum requirements to set up a blank page with all global modules and assets:
<?php include ('../app.php'); $title = 'Documentation'; $tagline = 'Lorem Ipsum Dolor Sit Amet'; ?> <!DOCTYPE html> <html> <?php include (ROOT.'/includes/head.php'); ?> <body> <!-- Site Canvas --> <div id="site-content"> <?php<!-- begin php --> <!-- Topbar Module --> topbar(); <!-- Header Module --> appHeader(array( 'modifiers' => 'bar-absolute-opaque-sticky' )); <!-- Billboard Module --> billboard([ 'title' => [ 'text' => $title ], 'tag-line' => $tagLine ]); ?><!-- end php --> <!-- YOUR HTML/PHP CONTENT --> ... <?php appFooter(); ?> </div><!-- Site Canvas --> <?php include (ROOT.'/includes/ui-enhancements.php'); ?> <?php include (ROOT.'/includes/scripts.php'); ?> </body> </html>
If you are using Grunt and the provided Gruntfile.js, you can easily compile and build your app for development and production envrionments generating appropriate HTML files from your source PHP templates - see the below Grunt tasks.
Task | Description |
---|---|
grunt |
The default grunt task - runs the below compile task as well as the watch task. |
grunt templates |
Used to generate HTML pages from your PHP templates (will only look for templates in the '/pages' directory). |
grunt compile |
This will compile your assets using the default value for the 'env' option. |
grunt compile:dev |
This will compile your assets for a development environment (assets will be unminified). |
grunt compile:prod |
This will compile your assets for a production environment (assets will be minified). |
grunt compress:images |
This will compress all images in the 'demo' directory using the TinyPNG API. Use liberally. |
grunt test |
This will execute code linters on your .scss and .js files. |
grunt setup |
This runs npm install and any neccessery Grunt tasks for vendor assets. This only needs to be done once during your initial setup. |
Using the grunt.option
API, you can pass several parameters on the command line when running the above tasks:
Variable | Default Value | Description |
---|---|---|
theme |
'Kayzen' |
This is the theme you wish to compile assets from. Theme must be present in the assets/themes directory. |
realm |
'demo' |
Can either be demo or live . Currently only used to serve placeholder images instead of stock photos. |
env |
'dev' |
Can either be dev or prod . Used to determine whether or not assets should be minified. |
host |
'server' |
Can either be static or server , and will define how your asset paths are created. |
themes |
false |
If enabled, assets will be compiled into individual theme folders (e.g. app/themes/Kayzen/scripts/app.js). |
The above options would be used when calling the grunt task, like so:
grunt compile --env=prod
grunt templates --theme=YOURTHEME
So you've created all your pages and configured all your modules, the front end for your project is now ready to test and then launch! There are several things you may want to test before you make your website live to ensure your users have the best experience possible. Below is a checklist of recommendations you can do to check your website is working properly and has no errors, as well as improving things like page load times etc.
You should be serving your users with minified versions of your assets (CSS and Javascript), as the file sizes will be smaller and load times faster. If you are using grunt, you can generate minified assets by running grunt compile:prod
, otherwise you can use the minified assets provided with your download.
If you are using our Gruntfile.js, you can run Javascript and Scss linters on your code. Simply run grunt test
to run both linters. To run only Javasctipt linting, run the grunt jshint
task, and to run only Scss linting run the grunt scsslint
task.
Check that you have no Javascript errors and are correctly loading assets by looking at the console. Right click anywhere on the page and click "inspect" (or "inspect element"). On the window that opens click the "console" tab. Any errors will be listed in red.
We are currently writing unit tests for all custom Javascripts. These, along with other such automated tests, will be released in furutre releases of Kayzen, so stay tuned.
Before you launch your site, check it in different browsers to makse sure it all works. Kayzen supports all modern browsers and degrades grecefully until Internet Explorer 9.
Check your website on multiple mobile devices before you launch to ensure there are no issues. Kayzen is fully responsive and should work and look great on all modern devices.
If you encounter any issues which you cannot resolve, you can get in touch with us to receive free support.