Build Tools
A quick overview of our build system used to test and compile our source code into documentation, CSS, and JS.
Tooling Setup
Figuration uses Node.js and Grunt for its CSS and JavaScript build system and Eleventy for the written documentation. This provides convenient methods for working with the framework, including compiling code, running tests, and more.
To use our Gruntfile and run our documentation locally, you'll need a copy of Figuration's source files, Node.js, and Grunt. Follow these steps and you should be ready to rock:
- Download and install Node.js, which we use to manage our dependencies.
- Install the Grunt command line tools,
grunt-cli
, withnpm install -g grunt-cli
. - Either download a copy of Figuration's source files or fork the Figuration repository.
- Navigate to the root
/figuration
directory and runnpm install
to install the local dependencies listed in package.json.
When completed, you'll be able to run the various Grunt commands provided from the command line.
Using Grunt
Our Gruntfile includes the following commands and tasks:
Task | Description |
---|---|
grunt |
Run grunt to run tests locally and compile the CSS and JavaScript into /dist . Uses Sass, Autoprefixer, postcss-flexbugs-fixes, postcss-calc, and UglifyJS. |
grunt dist |
grunt dist creates the /dist directory with compiled files. Uses Sass, Autoprefixer, postcss-flexbugs-fixes, postcss-calc, and UglifyJS. |
grunt test |
Runs stylelint, eslint and QUnit tests headlessly in Karma. |
grunt docs-test |
Tests CSS, JavaScript, and other assets which are used when running the documentation. |
grunt docs |
Builds and runs the documentation so it can be viewed locally. |
Sass Compiler
Figuration is compiled with node-sass via grunt-sass. There are no alternative options at this time.
In order to reduce potential issues with browser rounding, our build process has increased the Sass rounding precision to 6 (by default it's 5).
Autoprefixer
Figuration uses Autoprefixer (included in our Gruntfile and build process) to automatically add vendor prefixes to some CSS properties at build time. Doing so saves us time and code by allowing us to write key parts of our CSS a single time while eliminating the need for vendor mixins.
We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See our .browserslistrc
for details.
postcss-flexbugs-fixes
Also included in our Gruntfile and build process is postcss-flexbugs-fixes to work around some browser issues for flexbox layout. More information about these issues can be found over at the Flexbugs repository.
postcss-calc
postcss-calc is used to reduce calc()
references whenever possible.
Local Documentation
Running our documentation with Eleventy, a static site generator that provides us with: templating, Markdown-based files, and more. Here's how to get it started:
- Run through the tooling setup above to install all necessary development dependencies.
- From the root
/figuration
directory, runnpm run docs-serve
in the command line. - Open
http://localhost:9001
in your browser, and enjoy.
Learn more about using Eleventy by reading their documentation.
Troubleshooting
Should you encounter problems with installing dependencies or running Grunt commands or npm scripts, uninstall all previous dependency versions (global and local). Then, rerun npm install
.