It takes a combination of factors to keep things lean and mean so that our websites can load as fast as possible. There are many things we can do to help page performance including, but not limited to:
- Using a Content Delivery Network (CDN)
- Optimizing our images to the smallest possible file size
We can run our files through an optimizer that shrinks them down for us – but this is a time consuming process if we need to do it manually every time we make an adjustment. And then what? They are all shrunk down, and not very “human readable.” So we need to maintain an uncompressed copy somewhere, and then maybe work on that when we need to make changes – and then compress that original version down each time.
I’ve just mentioned shrinking down the files into a more efficient form, but Grunt also handles automated testing, linting, and more. Grunt has a huge (and growing) collection of plugins which extend its power to ever more uses.
How to install Grunt?
1. Install npm (Node Package Manager)
2. Use npm to install Grunt
echo "testing 1 2 3"; //comments are here $e = "that";
I’m happy to work on almost any Linux, on any server, hosted anywhere, but this page has a recurring theme of AWS Linux on an Amazon Linux AMI. In light of that I will make a special note that as of this writing, the default package manager for CentOS/RHEL (yum) does not contain a package for node. So we can use the instructions on this page to install Node, which Grunt requires:
First, we need EPEL:
EPEL 6: yum install \
EPEL 7: yum install \
Then install the nodejs and npm packages:
$ sudo yum install nodejs npm --enablerepo=epel
Need Some Global Installs
npm install -g grunt-init
And then there is project scaffolding…