massimo projects can be configured through a config.rb
file located in the root of your project or by using command line options. The config file will automatically detected when you run massimo commands.
config.rb
In the config.rb
file, you have access to all of the site's methods. For example:
config.javascripts_url = '/js'
config.stylesheets_url = '/css'
config.output_path = '_site'
if config.environment.production?
config.js_compressor = :uglifier
config.js_compressor_options = { :mangle => false }
config.css_compressor = :cssmin
end
resource :user do
unprocessable
end
helpers do
def users
User.all
end
end
This config file does a few things:
- It changes the URLs for the javascripts and stylesheets.
- It changes the output path to
'_site'
. - It uses Uglifier for javascripts compression during production mode.
- It sets options for Uglifier.
- It uses CSSMin for stylesheets compression during production mode.
- It creates a custom resource.
- It creates a custom helper method to access the custom resources.
Note the if config.environment.production?
block. This changes the configuration based on the environment setup in the command line.
Options
source_path | The path to the source files of the project. This can be changed on the command line using the --source-path=PATH option. Defaults to '.' . |
---|---|
output_path | The path to output the site to. This can be changed on the command line using the --output-path=PATH option. Defaults to 'public' . |
environment | A string representing the Site's environment. This can be changed on the command line using the --environment option or the --production flag. Defaults to 'development' . |
base_url | The base url of this site. You would change this if the site existed in a subdirectory. Defaults to '/' . |
[resource]_path | The path to where the given resources files are located. Defaults to the name of the resource. For example, pages_path defaults to 'pages' , and javascripts_path defaults to 'javascripts' . |
[resource]_url | The base url for the given resources. Defaults to '/javascripts' for javascripts and '/stylesheets' for stylesheets. Defaults to '/' for everything else. |
compress | When set to true , massimo will try to compress javascripts and stylesheets using whichever compression libraries are available.
|
compress_js | When set to true , massimo will try to compress javascripts using whichever JS compression library is available. |
js_compressor | Which javasript compressor to use. Available options are :jsmin (JSMin), :packr (Packr), :yui (YUI::JavaScriptCompressor), :closure (Closure::Compiler), and :uglifier (Uglifier). By default there is no compression. |
js_compressor_options | Sets options for the javascript compression library to use. |
compress_css | When set to true , massimo will try to compress stylesheets using whichever CSS compression library is available. |
css_compressor | Which css compressor to use. Available options are :cssmin (CSSMin), :rainpress (Rainpress), :yui (YUI::CSSCompressor), and :sass (Sass::Engine). By default there is no compression. |
css_compressor_options | Sets options for the css compression library to use. |
[template_extension] | Sets options for the Tilt::Template registered for that extension to use. For example, if you want to use some default options for Markdown templates: config.md = { :smartypants => :smart } |