I found this great wordpress plugin that helps make your wordpress theming more ruby like
It adds functionality for HAML, SASS, Compass, CoffeeScript, YUI Compressor, complete with the unbeatable rails structure and asset precompilation
So first we will install wordless as a global gem (this way you can use the command line):
gem install wordless
Then reload bash either by opening a new tab or running:
source ~/.bashrc
Command usage of the wordless gem is on the GitHub page: https://github.com/welaika/wordless_gem
Next to enable it to work with Rbenv:
Create the following two files in your home folder or whichever you choose:
wordless_compass
#!/usr/bin/env bash
export RBENV_ROOT="YOUR_RBENV_ROOT_HERE"
export PATH=/usr/local/bin:$RBENV_ROOT/shims:$PATH
eval "$(rbenv init -)"
export RBENV_VERSION='YOUR_RUBY_VERSION_HERE'
compass "$@"
wordless_ruby
export RBENV_ROOT="YOUR_RBENV_ROOT_HERE"
export PATH=/usr/local/bin:$RBENV_ROOT/shims:$PATH
eval "$(rbenv init -)"
export RBENV_VERSION='YOUR_RUBY_VERSION_HERE'
ruby "$@"
Make both files executable:
chmod +x wordless_compass wordless_ruby
Then update the path to these two files in the config/initializers/wordless_preferences.php file in your wordless theme:
Next lets change your Nginx config to work with the new asset paths
Add the following lines to your sites server block in nginx.conf:
# Send js and css requests to Wordless
location ~* \.(js|css)$ {
try_files $uri /index.php?$args;
}
# Directives to send expires headers and turn off 404 error logging.
location ~* \.(png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
If your interested in making it function even more like rails you can install the wordmove gem which is like capistrano for wordless but I will cover this in another blog post.