This is a custom starter Gruntfile that relies on a supplementary package-config.json
file and also assumes that your project has a package.json
file.
When using this Gruntfile and configuration, your project structure should contain the following:
-
src/
A folder used for source files. These, along with the files placed in
data/
directory, are the only files that you should edit directly. -
data/
A folder used for storing sample data files relevant to the project's development. These, along with the files place in the
src/
directory, are the only files that you should edit directly. -
dev/
An auto-generated folder that Grunt will create when using
grunt dev
. This folder is intended for use to preview the project during its development. -
dist/
An auto-generated folder that Grunt will create when using
grunt dist
. This folder is intended to store production-ready files that can be deployed into live environments.
The main purpose of the package-config.json
file is to act as a router for Grunt paths. In addition to this, the package-config.json
file is also used to dyncamically load projecg dependencies, stylesheets, and scripts.
This Gruntfile uses the following Grunt-specific npm
modules as dependencies:
grunt-contrib-watch
grunt-contrib-jshint
grunt-contrib-sass
grunt-contrib-copy
grunt-contrib-clean
grunt-contrib-uglify
grunt-contrib-cssmin
grunt-babel
grunt-includes
grunt-replace
grunt-copy-deps
grunt-postcss
This Gruntfile creates the following key Grunt tasks:
-
dev
Used during development,
grunt dev
will generate adev/
folder with a working preview of the project as the project is being worked on. The contents of thedev/
directory is pulled from bothsrc/
anddata/
folders. Additionally, thegrunt dev
command will launch a watch task that will automatically reload your project as changes are made. -
dist
Used for distribution,
grunt dist
will generate adist/
folder with production-ready project files. The contents of thedist/
directory is generated from both thesrc/
anddata/
folders.