Node.js and grunt on the hypernode
Because of the developments of theme can be a pain in the ass with less requiring to recompile after every change, it would be handy to have Node.js and Grunt on the server so that we don't have to recompile every change.
I know we can use client side compiling. But it takes about 6 - 7 seconds every reload. And with Grunt you can see the changes without even having to reload the page.
-
We have installed Node.js on the hypernode by default now, you can simply npm install packages, You may need to include the executables into your bash $PATH variable. See our documentation here: https://support.hypernode.com/knowledgebase/use-nodejs-npm-hypernode/
-
Joram van den Boezem commented
It's already possible to install node.js on a hypernode, we use a bash script for this. Make sure ~/local/bin is in your PATH so you can call node/npm from everywhere.
# Variables for installation
VERSION="v5.5.0"
FILE_NAME="node-$VERSION-linux-x64"
FILE_EXT="tar.xz"
FILE_PATH="$FILE_NAME.$FILE_EXT"
SOURCE="https://nodejs.org/dist/$VERSION/$FILE_PATH"# Grab node.js tarball and extract bin/lib directories to ~/local
cd ~
wget "$SOURCE"
tar -C "$HOME/local" --strip-components 1 -xf $FILE_PATH "$FILE_NAME/bin"
tar -C "$HOME/local" --strip-components 1 -xf $FILE_PATH "$FILE_NAME/lib"
rm -f "$FILE_PATH"# Install common node.js packages and downgrade npm to v2 to work around
# https://github.com/npm/npm/issues/10013
npm install npm@2 grunt-cli bower json gpagespeed -g