Build
Grunt process to compile, optimize, and minify your project
There are just a couple of tools you’ll need to compile a Wee project. We need to make a couple of assumptions about your knowledge of the command line. For instance, we’ll assume you know how to cd
and run basic commands.
Setup
- Install the latest Node.js.
- Install the Grunt CLI (Command Line Interface) using the NPM (node package manager).
- Navigate to your project in the command line and execute
npm install
to install the Wee dependencies.
Tasks
Default
Simply run grunt
from the command line to build your project once. This compiles and minifies all assets.
grunt
Static Server
Running grunt static
will continuously compile your CSS and JavaScript changes on the fly, launch a local web server, serve the static HTML files in the specified project root, and reload as necessary.
grunt static
Local Server
For more advanced needs, you will probably need to run your own local server to serve PHP and/or MySQL with something like MAMP (OS X) or EasyPHP (Windows). In that case you would use the grunt local
command. This uses the proxy settings you have specified in the project.json file and proxy to your local web server. As with the “static” command, grunt will continuously watch and compile your changes as you make them and reload your browser as necessary.
grunt local
Validate
Validate the current projects JavaScript source against defined standards. Read more about validation.
grunt validate
Generate
This task will generate the static site on demand. Read more about static generation.
grunt generate
Update
The update task will notify you if there is a newer version of Wee available.
grunt update
Script Build
- script.min.js - this is the primary script file. It is compiled from the following:
- Core scripts (as enabled in the project file)
- Vendor build directory files
- Remaining build directory files
- Project.config build files
- Custom/script.js
- Lib scripts minified in place
- Custom directives compiled
Style Build
- style.min.css - this is the primary CSS file. The following items are compiled:
- Reset
- Core components (as enabled in the project file)
- Vendor build directory files
- Remaining build directory files
- Project.config build files
- Custom/screen.less and breakpoints
- Custom directives compiled
- Lib scripts minified in place
FAQ
What is Grunt?
Grunt is an automated build tool. Wee uses Grunt to watch and compile your project as you go.
What is Node?
Grunt is built on Node.js, which is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Note
As noted in the Installation section, Node must be installed to run the Grunt compiler.