Configure webcompiler using a JSON file
mainTo customize the compilation, minification, or autoprefixing process, use a configuration file.
- Generate a default config: Run
webcompiler --defaults. This createswebcompilerconfiguration.json. - Modify the file: Edit the generated JSON to your needs.
- For Sass settings, refer to DartSassHost.
- For Minification, refer to NUglify.
- For Autoprefixing, refer to AutoprefixerHost.
- Run with config: Use the
-cflag to point to your file.
Example usage:
webcompiler -r wwwroot -c webcompilerconfiguration.json{
"Minifiers": {
"GZip": true,
"Enabled": true,
"Css": {
"CommentMode": "Important",
"ColorNames": "Hex",
"TermSemicolons": true,
"OutputMode": "SingleLine",
"IndentSize": 2
},
"Javascript": {
"RenameLocals": true,
"PreserveImportantComments": true,
"EvalTreatment": "Ignore",
"TermSemicolons": true,
"OutputMode": "SingleLine",
"IndentSize": 2
}
},
"Autoprefix": {
"Enabled": true,
"ProcessingOptions": {
"Browsers": [
"last 4 versions"
],
"Cascade": true,
"Add": true,
"Remove": true,
"Supports": true,
"Flexbox": "All",
"Grid": "None",
"IgnoreUnknownVersions": false,
"Stats": "",
"SourceMap": true,
"InlineSourceMap": false,
"SourceMapIncludeContents": false,
"OmitSourceMapUrl": false
}
},
"CompilerSettings": {
"Sass": {
"OutputStyle": "Expanded",
"RelativeUrls": true,
"SourceMap": false
}
},
"Output": {
"Preserve": true
}
}