Get started
To start using MilkShake we must first install it, we can use the following command in your preferred terminal::
npm install @sammwy/milkshakeNote: You need to have Node.js and NPM installed on the system.
Prepare and run Task
We will start by preparing a simple task that concatenates and minifies CSS files and then processes them into a single file. In turn, each source file is modified, created or deleted then the process will be repeated.
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ cssTask: { source: "./demo/source/css", dist: "./demo/dist/bundle.css", messageEnd: "CSS Minified succefully" } });
Javascript minify Task
We can concatenate and minify Javascript files into one with the following task:
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ jsTask: { source: "./demo/source/js", dist: "./demo/dist/bundle.js", useES6: true/false, messageEnd: "JS Minified succefully" } });
Image compress Task
We can compress and optimize JPG and PNG files with the following task:
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ imageTask: { source: "./demo/source/images", dist: "./demo/dist/images", messageEnd: "Images compressed succefully" } });
Less compile Task
We can compile and minify Less files with the following task:
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ lessTask: { source: "./demo/source/less", dist: "./demo/dist/bundle.css", messageEnd: "Less compiled succefully" } });
Sass compile Task
We can compile and minify Sass files with the following task:
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ sassTask: { source: "./demo/source/sass", dist: "./demo/dist/bundle.css", messageEnd: "Sass compiled succefully" } });
Stylus compile Task
We can compile and minify Stylus files with the following task:
const milkshake = require("@sammwy/milkshake"); milkshake.tasks({ stylusTask: { source: "./demo/source/stylus", dist: "./demo/dist/bundle.css", messageEnd: "Stylus compiled succefully" } });