Angle Docs

AngleBootstrap 4 Admin Template + HTML5/jQuery

Thank you for purchasing Angle - Bootstrap 4 Admin Template + HTML5/jQuery.
If you have any question about this product and beyond the scope of this help file, please feel free to write us using the support button.


Thanks so much!

Introduction

This document aims to explain the best way to work with the product and its components.

- All the best and enjoy coding.

Getting started tips

  • Do not start from scratch, use an existing asset and modify it to learn how it works.
  • Explore the sources for ideas and sample code.
  • Use Firebug or Chrome Developer Tools to find bugs on your website. Using one of those tools will help you to save time analyzing the site and finding elements structure, like classes, id or tags
    • Quick tip: open your site with Chrome, press F12 and go to console tab, reload your page and if something goes wrong you will see your page errors in red text.
  • In case of errors, someone might have seen it too, you can try a Google search for a quick fix.

Starting the app

It's recommended to run this application using a server (Apache, IIS, xampp, etc) to serve the html files and perform necessary http request.
Anyway, this project doesn't need a server but some components will not work if the application is not running from a server.

Basic server setup (requires nodejs)

This is simple solution for a basic server setup using nodejs that might help you. If you don't have installed nodejs take a look at the Build section to learn about it

  • Install the http-server (-g installs globally)

    npm install http-server -g

  • Move to the root folder of the theme (where index.html is located) and run

    http-server . -a 127.0.0.1 -p 8080

  • If everything goes fine you can now access to the app at http://127.0.0.1:8080/

Structure

Before starting to customize the template, here is the project files organization structure:

+---app
|   +---css
|   +---img
|   +---js
|   +---server
|   +---vendor
+---master
    +---img
    +---js
    |   +---custom
    |   +---modules
    |       +---charts
    |       +---common
    |       +---documentation
    |       +---elements
    |       +---extras
    |       +---forms
    |       +---maps
    |       +---pages
    |       +---tables
    +---pug
    |   +---views
    |       +---charts
    |       +---dashboard
    |       +---documentation
    |       +---elements
    |       +---extras
    |       +---forms
    |       +---maps
    |       +---multilevel
    |       +---pages
    |       +---tables
    |       +---widgets
    |       +---_partials
    +---sass
    |   +---app
    |   |   +---charts
    |   |   +---common
    |   |   +---documentation
    |   |   +---elements
    |   |   +---extras
    |   |   +---forms
    |   |   +---layout
    |   |   +---maps
    |   |   +---tables
    |   +---bootstrap
    |   +---themes
    +---server

Main folders explanation

app/

This folder contains all assets necessary to run the application (images, etc) and compiled source files. This files are ready to deploy on your server. This folder is generated using Gulp.

  • css/ This folder contains the compiled stylesheets.
  • js/ This folder contains only the final build of javascript files.
  • vendor/ This folder contains vendor assets that are included in the html file. Files are placed here using Gulp.
  • server/ This folder contains server side files used for demonstration. In a real app your server should listen to a specific address and return the content of this files (and/or others) with specific information.

master

This folder contains the source files organized in subfolder for easy reference. Each folder contains PUG(ex JADE), SCSS and JS files. As you can see, the subfolder structure is similar to the menu structured presented in the template.

master/node_modules

This folder contains dependencies for installed using npm

app/vendor

This folder contains vendor assets, it's populated with the list of files declared in the file master/vendor.json. This file is used to filter only what is necessary for the template avoiding to copy any other extra file that comes with the package installation.

Build

Important You only need to follow this instructions if you plan to use build tools.

Build Tools

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications.

Gulp is a task manager, you can define different tasks to run certain commands. Those commands does the compilation job for precompiled languages (PUG/SCSS), and concatenates the JS files.

The package includes under the master/ folder the file gulpfile.js and package.json to install the required components in order to compile the source files.

Installing tools

The following steps are intended to be an orientation guide, if you are not experienced with this you will need to learn a bit more about it from Google :)

Once you have all tools installed

  • Open a console/terminal and run npm install -g gulp to install Gulp

  • Move to the package master/ folder, there run the following commands

    • This command will install all node dependencies. npm install.
  • Finally run gulp serve to start the task manager.

If everything goes fine, you should see messages in your terminal telling you that all the task are done ok. Gulp will watch for file changes to compile them automatically and will open the application using your favorite browser.

Gulp customization

If you need to change the configuration used by Gulp, mainly paths or plugin options, you can do that by editing the file gulpfile.js

Main Gulp tasks

Gulp tasks must be executed under folder master

> gulp serve

This command will run the build task and start the built-in server using BrowserSync

> gulp build

Use this command to build the application for development. All compiled files will be placed under 'app' folder.

> gulp serve --prod

The '--prod' flag indicates the task is executed for production. In this case gulp will compile and start a server with production ready files, meaning, all files will be compressed including vendor assets. Note that the built-in server is not recommended to be used for production environments.

> gulp build --prod

Use this command to build the application for production. All compiled files will be placed under 'dist' folder.

> gulp serve --sourcemaps

This modifier will create source-maps when compiling assets. Ideally used with Gulp serve for development.

> gulp clean

Delete build files

Be careful the clean task will delete all files under 'app' folder without any confirmation or undo option.

Usage

This template was developed to use Gulp as the main tool of the development workflow.
Gulp provides plugins to serve the app, perform automatic browser reloading after any change and build of assets for distribution. It also allows to work with agile languages like PUG/SCSS/etc and modular JavaScript (concatenated).

Beyond that, if you are not convinced about build tools, the current setup has a basic support to work with static files (html, css) without needing build tools.

We encourage you to use build tools, the benefits greatly outweigh the costs of learning.

Static files organization (no Gulp)

The most simple usage is by pointing the server root the 'app' folder of the package. Note that the index.html included in the root of the project is just a redirect to dashboard.html.

This allows to work directly with raw files like CSS, HTML and JS without worrying about build tools.
Now, to edit files, focus on the following locations:

  • Styles are accessible in folder /app/css
  • Markup is accessible in folder /app (raw html)
  • Scripts are accessible in folder /app/js

Important if you change something on this folder and then switch to use Gulp, all previous changes may be lost because Gulp uses this folder as destination to place compiled files.

Compiled files organization

As a quick reference, the current setup does the following compilations:

Language Produces
PUG HTML
SCSS CSS
Javascript Javascript (concatenation)
Styles

For styles we use two files

sass/bootstrap.scss This files will be compile to bootstrap.css with the framework rules modified to match the template styles.

sass/app.scss This file contains template rules for different components and plugins. This file also @imports some files from Bootstrap like variables and mixin to easy the development.

Scripts

All scripts are concatenated into one single file app.js The order of concatenation is the following:

app.init.js
modules/**/*.js
custom/**/*.js

Layout

One of the main benefits of using PUG is that we can use partials templates to write common parts of a page only once and reuse such template many times. This happens also for layout, similar to templates but allows to define 'blocks' where we will add later markup for a specific page.

Behavior classes

As you can see in the index, there are some classes related to the sidebar that are used to change the layout behavior.
This classes are:

Classname Description
.layout-fixed Makes navbars become fixed while the user can scroll only content
.layout-boxed Limits the width of the main wrapper element
.aside-collapsed Condenses the sidebar showing only icons
.aside-collapsed-text Condenses the sidebar showing icons and Text
.aside-toggle used internally for mobiles to hide the sidebar off screen
.offsidebar-open used internally to display the offsidebar component (formally the right sidebar)

The following markup representation is in fact divided into views but this code will give a good perspective of the final organization after the app is rendered:

<html>
  <head>
    #metas and css
  </head>
  <body>
    <section class="wrapper">

          <nav class="navbar topnavbar">
            #top navbar content
          </nav>

          <aside class="aside">
            #sidebar content (left)
          </aside>

          <aside class="offsidebar">
            #offsidebar content (right)
          </aside>

         <section>

            <div class="content-wrapper">
              #page content
            </div>

          </section>
     </section>
     #scripts
  </body>
</html>

The file *sidebar.json *contains the sidebar menu items configuration for easy customization. Using PUG you need only to edit this file in order to change the sidebar items

Vendor

Vendor script dependencies are managed by npm. Just run npm install in folder master/ and all dependencies will be installed.

Vendor folder

To avoid unnecessary files that comes with each package there’s a Gulp task that will copy all files required by the template from the node_modules folder to the app/vendor folder.

This files are listed in *vendor.json * which contains the paths of all files required.

Vendor Updates

To update vendor files via NPM you can edit the package.json file by adding the last version you want to download. Please note that each version of the template is developed and tested with the versions included, if you update plugins is not guaranteed they will work "out of the box".

RTL

RTL support uses the a tool called "rtlcss" which inverts most the css properties to change the page orientation.

To use the rtl version just include the rtl version of the stylesheets in your html files

<link rel="stylesheet" href="css/bootstrap-rtl.css">
<link rel="stylesheet" href="css/app-rtl.css">

Translation

The translation system uses jQuery Localize

This modules simplifies the translation system by loading translate references from a JSON file and replacing the content where the reference has been used.

Examples

<small data-localize="dashboard.WELCOME"></small>

The JSON files with translation references are located in the folder app/i18n

See also dashboard.html to find example on how to change the language manually

Themes

To change the color scheme you have 2 options:

From SCSS files

Edit the SCSS files in folder master/scss/ to use the color you want. Like Bootstrap, most of the colors are based on variables.

You can also edit the files in master/scss/theme folder to create your own set of color schemes. This files must be included after the app.css in order to override the default color set.

Changing the theme colors from SCSS files helps you to avoid bloating your css by not double declaring your color rules.

From CSS files

This template support color schemes including a css file. You can find the color options in the folder app/css/ files are named theme-*.css

If you want to change or add a new component color, just inspect the color using your favorite browser devtool and then replace the value in the file.

This files are prepared to change the basic color scheme (both sidebars and top navbar) but if you want to make a more deep change, check the SCSS source files which is more simple for multiple component changes.

Default Theme

To set a default just include in your HTML files the stylesheet of the theme of your choice right after the main stylesheet (app.css)

Custom code

To add your own code you can follow this instructions:

Working with css and js

  • Create a file app/css/custom.css and add your own styles
  • Create a file app/js/custom.js and add your own javascript

Edit the HTML files and include custom.css after all other css files and custom.js after all other js files.

Working with source files

For JS, go to folder master/js/custom and start editing the file custom.js. After compile the source again with Gulp, your own code will included at th bottom of file app/js/app.js.

For SCSS, go to folder master/scss and create a folder named custom and add your own files. Then edit file app.scss and @import all your stylesheets at the bottom (overrides all app default styles)

A note on updating The premise is, the less you change the downloaded code, the easier will be to apply any updates. Try always to keep your own code the most separated as possible from the package code to easily apply new updates when necessary.

jQuery and Wrapper script

Starting from version 4.1, this template doesn't need jQuery as a mandatory dependency for core files, this means it is only required when using jQuery based plugins for some features included.
Seed project versions no more include jQuery by default..

The wrapper.js (~ 7k minified) is a new script introduced to emulate some specific jQuery functions used in the template. This made possible to significantly cut the refactoring changes in the code, keeping it readable in a jQuery way and avoiding extra bytes, mainly when loops are repeatedly used to work with multiple elements.

Important The Wrapper script is NOT a replacement for jQuery. All methods were designed for an adequate and specific use and they don't do a deep validation on the arguments provided. It's suggested NOT to use this library extensively. Instead, use pure JS or you might even need jQuery.