The Engage Interactive website baseplate.
- Auto-prefixed CSS compiled from Sass, written using the BEM methodology
- ESLint-ed JavaScript with source map support and native error notifications
- Image compression using the TinyPNG API
- SVG sprite generator
- Browsersync-based watch script
We've all played with the latest baseplate/boilerplate/bootstrap but were never truly happy with them. We've produced somewhat of a halfway house between the HTML5 Boilerplate and something like Foundation. It contains the usual basics, plus some really useful core files and project settings.
- Node.js
- Long-term Support (LTS) build is fine
- Check your npm permissions (typically option 1)
- Gulp
- Installed globally by running
npm install --global gulp-cli
in Terminal
- Installed globally by running
- TinyPNG Developer API Key
- Setup as an environment variable with key
TINYPNG_KEY
- Run
echo "export TINYPNG_KEY=YOUR_KEY_HERE" >> ~/.bash_profile && source ~/.bash_profile
in Terminal (replacingYOUR_KEY_HERE
with your key)
- Setup as an environment variable with key
- Navigate to your project's root directory in Terminal(?!?)
npm install
- installs the dependencies for this project
- can take several minutes
- will output a lot of debugging information (including occasional deprecation warnings) that can be ignored
- Open
gulpfile.js
and check/update theconfig
object
- note - non-static projects (i.e. PHP) still require setting up in Apache/NGINX
gulp
- recompiles everything (optional)gulp watch
- starts Browsersync and watches for file changes- you can
⌘
+ double-click the local address shown in Terminal to open the link - you can alternatively use your machine's network name, e.g.
joe.local:5757
- keep an eye on Terminal if it seems like changes aren't showing up in your browser
- stop the process using
ctrl + c
- you can
gulp clean
- deletes all compiled assets
main.scss
is the top-level Sass file, which typically just imports the _variables
and _import
partials. This split allows for the fixed width functionality.
References all of the Sass partials to be included in the project.
Everything from font sizes, to colours, to easing function timings.
The functions file is new. We will be using this more in the future, for now it just contains a copy of the foundation rem-calc function.
These are some really generic mixins and extenders that we use on nearly every website we create. The animations file is empty as animations tend to be very specific, but we usually end up adding them, so the file exists simply for convenience.
Initially based off the Foundation grid, we've produced a stripped down version of our own.
Our English spelling version of the Normalize.css file with a few very slight modifications.
Useful, commonly-used classes that can be used throughout the project. If the element will never change, use a class. If you're using a helper after a certain breakpoints, it would be better to call the relevant mixin.
This file should contain any @font-face
rules or remote file URL's. By default we include Open Sans.
These files contain the very basic building blocks to the project. They contain really low-specificity elements and/or classes. Examples includes form inputs, basic image styling, and base typographic styles.
The modules category should be used to style up site-wide self-contained elements. For example, forms, modal overlays, login forms, lists, pagination, twitter includes.
The layout category should contains files that affect the structure of the site, for example the navigation, site header and footer. Essentially, any distinguishable section of a design that isn't re-used elsewhere.
Finally, the pages category is used to style up page-unique content/layout. When you include the project into a framework, a kind developer will add a class to the body of the site. You can use this to namespace your styles so that you don't affect any other content.
We've included the usual here, jQuery and Modernizr, along with some in-house plugins:
- fitvids.js
- loadImg.js
- preload.js
- simpleSelect.js
This contains a basic JavaScript file structure with a few bits of functionality and plugins we always use. The noteable parts are:
- Window scroll and resize listeners which keep a global object storing site metric information up-to-date.
- External and internal link handling
- Simple select plugin which allows you a large amount of control over the visuals of a select dropdown.
- Buffered window resize callback.
If you don't need something, just remove it.
Included in the baseplate is a very, very, very simple example of the grid and site structure we like to start with in a lot of cases. This is by no means what we always use though, so feel free to delete it all and start again!
The optional fixed-width.scss
Sass file outputs CSS with all the media queries removed. Set fixed-width-limit
to adjust the max-width used.
Check you've enabled System Preferences > Keyboard > Shortcuts > Services > New Terminal at Folder
, then you can right-click the project folder, choose services (at the bottom) and just click New Terminal at Folder
.