This guide has been tested on Ubuntu 14.04, but can be easily used for others systems as well.
Setup the enviroment
Install packages
First of all, you need to install necessary packages:
sudo apt-get install npm ruby ruby-dev make nodejs
sudo gem install sass
sudo npm install -g grunt-cli
Get the code
Unfortunately, our Gitlab installation doesn't use standard ssh port. You need to edit your configuration if you want to clone using ssh. Add in your ~/.ssh/config the following configuration:
host code.ubuntu-it.org
user git
port 2222
In this guide we will use ~/ubuntu/website/valencia
as installation folder. You can use whatever folder you want.
Take the code:
cd ~/ubuntu/website/valencia
git clone git@code.ubuntu-it.org:ubuntu-it-web/valencia.git
If you don't have an account on code.ubuntu-it.org, you can use HTTP instead of SSH:
git clone http://code.ubuntu-it.org/ubuntu-it-web/valencia.git
Then you need to install package dependencies:
cd ~/ubuntu/website/valencia
npm install
Grunt commands
grunt
Grunt watches every js file and every sass file. Every time a file is modified checks for syntax errors and compiles the sass files. Additionally, checks for errors in the modified js files. Good for development.
grunt dist
This command is for production only: it compiles sass files, compressing them.
grunt check
Checks the syntax of every sass and js file. Useful to check for errors before running grunt dist
.
Troubleshooting grunt
Here we list some common issues with grunt.
/usr/bin/env: node: No such file or directory
If you use Ubuntu, you might see the error above.
Do not install the node
package! It has nothing to do with nodejs. You should install the package nodejs-legacy
instead:
sudo apt-get install nodejs-legacy