This document describes all available configuration options of mango.yaml, mango.json or mango.config.js file.
src_folder
- a folder with all source files. Content of this folder is watched in dev mode for changes. This path is filtered from destination path.dist_folder
- build destination folder. The only one required option.dist_persistent_folder
- a folder to build all assets except html into, defaults to value ofdist_folder
All fields are array of filepath masks, relative from the mango config file file.
styles
- stylesheets. Can be CSS, LESS, SASS, Stylusscripts
- javascript. Files are treated as modules which don't leak to global namespace. StringDEBUG
is replaced with true/false based on dev/build task.images
- image resources. Images are minified in dist build, but just copied in dev mode.static
- static resources. Static files are copied to dist folder.templates
- templates. Static HTML files or Jade|Pug templates.sprites
- svg symbols. Creating SVG sprites from multiple SVG files.buildstamp
- cache control. Renaming specified files in dist folder with build unique prefix.
dependencies
- an array of NPM packages. They are installed intonode_modules
folder withmango install
command. Then they are available in scripts asrequire('module')
calls.version
- semver string with required mango-cli version. Like>=0.18
data
- object containing data supplied to templates in build time.
Format: "globalname": "any variable type OR filepath to JSON / YAML file"
If globalname
match filename, its value gets assigned as current scope, overriding (but not clears) previous state
hooks
- object with additional commands you need to run before/after certain actions. Prefixpre
means before a task, no prefix means after a task finished.
Format: "hookname": "command line command"
Available hooks: init
, preinstall
, install
, prebuild
, build
, predev
, dev
, watch
All options can be overridden in mango.local.yaml
(or mango.local.json
) file. Handy for development and deployment.
browsersync
- options passed to BrowserSync dev serverproxy
- start dev server in proxy modewatch
- additional files to watch resulting in browser reloadchokidar
- extra options passed to chokidar file watcher. Defaults...
stylus
- options passed to Stylus compiler. Default sets'include css': true
autoprefixer
- options passed to CSS Autoprefixercssmin
- options passed to clean-css in build task.disableSourcemaps
- skips source maps in dev mode whenfalse
pug
- options passed to the Pug compiler. Defaults arepretty: true
,cache: true
,doctype: 'html'
templates
- it's elements can be string (glob) or object for generating multiple files from single template. The object needs to have two properties:template
(containing filename of the template) anddata
(file containing json object where keys will become filenames for generated html and values will be passed to template infileData
variable)- Additional data passed to templates:
devmode
== mango dev, andproduction
== mango build - You can also use
require()
inside a template
images
- array of all images - element can be: * string (glob) of source image for minification or * object for resize *src
- string (glob) source of images *sizes
- array of widths (int) *aspectRatio
- aspect ratio of image on output (float = width/height), if undefined or false aspect ratio of image is used *options
- output options for sharp resizing engine
webpack
- extra options passed to webpack configuration object
sprites
- an array of objects. Each object contains:path
- to SVG files (e.g.src/images/sources/foo/*.svg
)name
- (optional) a prefix to SVG ids in generated sprites and name of the filefilename
- (optional) name of file to which will be sprites generated
cleanup
- prevents dist_dir cleanup whenfalse
buildstamp
- an array of file paths. A copy of selected files is made with prefix unique to each build in filename. The prefix is available by#{buildstamp}
in jade and stored in filedist_folder/.buildstamp.txt
for other template engines. In development the prefix is empty.
File extensions are mapped to a certain task by default. This setting can be overridden in the mango config file. For example:
"mapping":{
"scripts": ["js", "jsx", "es6", "es", "coffee", "my.extension", "tpl.html"]
}