Grunt taskrunner starter-kit for developing accessible and performant .php websites
You will need Node version < 12.x* installed on your local development machine.
- Issue with generating favicons with Node versions > 12.x, see issue
To get your starter-kit up and running:
npm install
grunt install
grunt start
Task | Description |
---|---|
grunt install |
Compile core project assets |
grunt start |
Start development server and watch assets and files |
grunt build |
Build production optimised project assets and files |
- Include initial favicon image to
/assets/favicons/src
- Recommended dimensions for initial favicon image:
260px by 260px
- Serves .php files with PHP built-in web server
- Hot-reloading in browser when files are updated
-
Snippets are written to the
/snippets
folderWriting snippets:
<?php // Define expected prop keys and default values ${:key} = ${:key} ?? {:default_value}; ?> <div> <?php // Use prop values in mark-up echo ${:key}; ?> </div>
-
Snippets can be included onto templates or other snippets
Adding snippets:
<?php $data = [ // data array key-value pairs are passed and scoped to // snippet files as prop variables '{:key}' => {:value}, ]; // path string is relative to /snippets folder snippet('path/to/snippet', $data); ?>
- Templates are written to the
/templates
folder - Includes commonly used core snippets and a basic site structure for
- Rapidly developing websites
- Supporting other project features (e.g. favicon generation and injection, .etc)
-
Individual .svg icon assets are written to the
/assets/icons/src/
folder -
Icons are compiled into a single spritesheet, and can be included in the project as a media snippet:
Adding icon:
<?php snippet('media/icon', ['icon' => '{:name}']); ?>
-
Keeping icons as symbols in an .svg spritesheet allows for additional CSS styling control (e.g.
fill
,transition
, .etc) -
Optimised fall-back .png files are also generated from original .svg icon assets
-
Default (and recommended) dimensions for icon:
24px by 24px
- Both vector and bitmap image assets are written to the
assets/img/src/
folder - Optimised fall-back .png files are also generated from vector image assets
- Foundational style reset/normalising
- Use of Atomic CSS style classes (e.g.
w-100
forwidth: 100%
) for base styling - Use of OOCSS style overriding classes to support project-specific component styling
- Compiles Sass files from
assets/sass/
folder toassets/css/
folder - Sass files are compiled to a single stylesheet to reduce number of stylesheet requests
- Sass files are grouped to reflect multilayered style of organising and component structure:
| foundation | -- config | -- reset | -- tools | base | -- layout | -- typography | -- theme | project | -- element | -- component | -- composition | -- page
- On build, critical CSS is generated for all templates listed in
templates/
folder $template
prop in template files must match filename for correct automation
- Library scripts are added to the
assets/js/src/
folder - Library scripts are concatenanted to the project script to form a global script to reduce number of script requests
- Write with the latest features and allow Babel to compile down to ES5 for browser compatibility.
- Optimised global script is generated after project script is concatenated with any library scripts
- Uses Barba.js to enhance with client-side rendering
- Page transitions are customisable with default loader
- Added basic Google Analytics implementation to reduce intergration time to Google Analytics
- Added control when linking fonts with Web Font Loader, to improve loading experience