This tutorial shows how to work with CSS/HTML sources files (pug/scss) in our Multipurpose Website templates.
You can find the source files in the sources folder of your template (be sure to unzip the zip file with the source files). Pug files allow editing website pages, scss files should be used for adjusting website styles.
Pug source files
1. Typical structure of files inside the pug folder:
Please, note, that templates may have different files structure (some files like functions.pug, mixins.pug and folders may not be available specifically in your template).
2. General structure of pug sources:
- The _skeleton.pug file has code that should be included to all files. In most cases this applies to to the tags like
<body>, contents of the
<head>tag and global includes used on every page (_elements.pug, _config.pug).Example of the code used in the _skeleton.pug file:
- The _config.pug file is a configuration file. Such file contains different kinds of global variables (navigation, buy-link, callto-link, layout switcher etc.). The file should be included to _skeleton.pug file.Example of the code used in the _config.pug file:
- The _elements.pug file has mixins for elements (button, image, link etc.). Such elements can be included to any page or component. The file should be included to _skeleton.pug file.Example of the code used in the _config.pug file:
- The components/ folder consists of files with file components. Each file has mixins to which different kinds of content are being passed as parameters (blurb, post). Components should be included to the pages that require components.Example of the code used in the component:
- The includes/ folder contains files with ready-made content that should be included to all pages. Content of those files is the same on all pages. For example, the navigation is the same on all pages, sidebar can be the same on all pages.
- The sections/ folder contains files with ready-made sections (slider, blog, gallery etc.). In general, sections should be included to the appropriate page (where particular section should be placed).Example of the
- The pages/ folder contains page files for compilation. In general, pages should be compiled to the root folder of the website.Example of code used in the page:
- We should compile .pug files to html. Such compilation can be performed using the trial version of Prepros software.
- Open Prepros software. Go to the sources folder of the template package (be sure to unzip the sources zip file before that). Add a pug folder to Prepros. You may drag the entire folder to the projects section of Prepros.
- Set the relative path for all .pug files. All pug files should be compiled to the root folder of the site.
- Click on Process File in order to compile the file.
- Appropriate html file will be created in the location we have set previously.
SCSS (SASS) source files
1. Typical structure of files inside the sass folder:
2. General structure of scss source files:
- The bootstrap/ folder has bootstrap files.
- The bootstrap.scss file is a main file for bootstrap compilation.
[notice type=”warning”]Do not edit bootstrap code. You should perform changes to the template styles instead.
- The custom-styles/ folder has unique template styles.
- The style.scss file is a main file for compiling template styles. Such file includes variables, mixins, styles for components and plugins.Example of code used in the style.scss file:
- The fonts.scss file is a main file for compiling template icon fonts. Such file includes references to the font styles from the folder fonts.Example of code used in the fonts.scss file:
- The _variables-custom.scss file contains global variables for styles, colors, fonts, variables for elements.Example of code used in the _variables-custom.scss file:
- The _reset.scss file is used for resetting bootstrap styles (when such actions are required).Example of code used in the _reset.scss file:
- The _mixins.scss file contains mixins. This file includes references to files inside the mixins/ folder. Example of code used in the _mixins.scss file:
- The components/ folder contains styles for components. Reference to each component should be included to the style.scss file.Example of code used in the component style (_blurb.scss):
- The fonts/ folder contains styles for iconic fonts. Reference to each file should be included to the fonts.scss file.Example of iconiс font styles (_mdi.scss):
- The helpers/ folder contains styles for helper elements. Reference to helper files should be included to the style.scss file.Example of code (_text-styling.scss):
- The mixins/ folder contains mixins. Reference to mixins should be included to the _mixins.scss file.Example of code (_buttons.scss):
- The plugins/ folder contains files for plugins styles. Reference to files should be included to the style.scss file.Example of code (_to-top.scss):
- We should compile scss files to css. Such compilation can be performed using the trial version of Prepros software.
- Open Prepros software. Go to the sources folder of the template package (be sure to unzip the sources zip file before that). Add a sass folder to Prepros. You may drag the entire folder to projects section of Prepros.
- All sass files should be compiled to the website root folder.You can compile files without underscore at the beginning of file names. Files like _toolkit.scss are not independent files and can not be compiled directly.
- Let’s compile style.scss file. Select the file in the Prepros. Click on ‘Process file’.
- The style.css file will be created in the website root folder.
In this tutorial we have found out how to work with CSS/HTML sources files (pug/scss). We have also provided information regarding the structure of the source files used in our templates and included examples that provide information regarding the coding structure of particular files.