Build tools
Learn how to use included npm scripts to compile source code, run local dev server, and more.
Tooling setup
PROFI uses npm scripts for its build system. Our package.json includes convenient methods for working with the framework, including compiling code, running local development server and more.
To use our build system locally, you’ll need a copy of template’s source files and Node. Follow these steps and you should be ready to rock:
- Download and install Node.js, which we use to manage our dependencies.
- Unzip your theme and navigate to its root directory and run
npm install
to install our local dependencies listed inpackage.json
.
When completed, you’ll be able to run the various commands provided from the command line. It’s that simple! If you’re not used to using terminal, don’t worry, this is as advanced as it gets. If you want to kill the server and stop all tasks, just hit Control + C
.
Using npm scripts
Our package.json
includes the following commands and tasks:
Task | Description |
---|---|
npm start |
Starts local development server with browsersync . |
npm run build |
Compile & minify all your sources. Output of this command will be placed to the /build directory. |
Run npm run
to see all the npm scripts.
Twig
Template sources are written with Twig template engine. You can find our its documentation on Twig’s official website.
Autoprefixer
PROFI uses Autoprefixer (included in our 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 package.json
file within dedicated browserslist
key.
Troubleshooting
Should you encounter problems with installing dependencies, uninstall all previous dependency versions (global and local). Then, rerun npm install
.