Haml by default on Rails?

voltando a postar após uma longa jornada.

método do preguiçoso eficiente:
rails new ProjectName -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb

e que tal, além disso, achar uma feature escondida do rails?

então edite o arquivo $HOME/.railsrc e adicione a opção para aplicar a mastersheet automaticamente:

# cat ~/.railsrc
-m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-haml-html5-template.rb

source: http://decielo.com/articles/377/haml-by-default-in-a-new-rails-3-2-app

LESS CSS – Uma mão na roda!!

Hoje eu resolvi instalar o LESS CSS no ambiente de desenvolvimento (higgs).

A ideia era ter o servidor pronto para compilar os arquivos LESS automaticamente, sem precisar rodar os comandos manualmente.

Acabei passando alguns apuros, mas aqui vai um simples road-map:

Instalando LESS

Existem 2 opções:

1- Sem o instalador NPM

# Download latest version of node.js
# please replace the url with the newest available version, which you can find here http://nodejs.org/#download
wget http://nodejs.org/dist/node-v0.4.7.tar.gz

# extract node.js install package
tar xfvz node-v0.4.7.tar.gz

# change working directory
cd node-v0.4.7

# configure
./configure

# compile it
make -j4

# install it
make install

# go back to home
cd ~

# download less
wget --no-check-certificate https://github.com/cloudhead/less.js/tarball/master

# extract
tar xfvz cloudhead-less.js-v1.0-336-g853604a.tar.gz

mv cloudhead-less.js-853604a lesscss
mv lesscss/ /usr/local/

cd /usr/local/bin/
ln -s ../lesscss/bin/lessc

Source: http://www.pimcore.org/wiki/display/PIMCORE/Install+lessc+on+your+server+%28Debian%29

2- Com o instalador NPM (recomendado)

Instale o Node.js

Depois:

> npm install -g less

Rodando LESS

> lessc main.less main.css

 

Rodando LESS automaticamente

Instale o inotify-tools: https://github.com/rvoicilas/inotify-tools/wiki

Depois…

> vi  /usr/local/bin/lesscwatch

#!/bin/bash # Detect changes in .less file and automatically compile into .css 
[ "$2" ] || { echo "Specify both .less and .css files"; exit 1; } 
 inotifywait . -m -e close_write | while read x op f; do 
 if [[ "$f" == *".less" ]]; then 
 echo "Change detected. Recompiling..."; 
 lessc $1 > $2 && echo "`date`: COMPILED"; 
 fi 
 done 

Source: http://stackoverflow.com/questions/13671969/how-to-automatically-compile-less-into-css-on-the-server