Manual Use
If you don't feel like using the automation, you can also concatenate, minify and optimize manually.
Concatenate CSS
Use following command to concatenate your CSS files.
gulp concatcss
Concatenate JS
Use following command to concatenate JS files.
gulp concatjs
Minify CSS
Use following command to minify CSS files.
gulp mincss
Minify JS
Use following command to minify JS files.
gulp minjs
Image Optimization
Use following command to optimize images inside /assets_dev/img/ folder.
gulp imagemin
Purge CSS
-
Navigate to
node_scripts, openconfig.jsonto add list of css files to purge."purge_css": [ "assets/css/main.css", "assets/css/main.min.css" ], -
You can also add
selectorsto the"safelist"and they will not be removed. Classes generated by WordPress are already added to the list."safelist": [ "dl", "dt", "dd", "dfn", "cite", "em", "i", "blockquote", "pre", "code", "tt", "var", "abbr", "acronym", "mark", "ins", "table", "tbody", "td", "th", "embed", "iframe", "object", "aligncenter", "logged-in-as", "form-submit" ], -
Use the following command to remove unused CSS from the files you have mentioned in
config.json.gulp purgecss
If you think there should be more classes added/removed to the "safelist" please open an issue on our github repository. By the way selector list in config.json is not the only "safelist", there is also pattern added in gulpfile.js