Dynamic Mappings / Settings with Compass

2008 June 21
tags:
by Shay Banon

One of the upcoming Compass 2.1 M1 features include a much requested feature by users which is the ability to dynamically remove and add mappings using the Compass instance. So, Compass instance now allows to get its internal ComapssConfiguration object and change it dynamically (not just mappings, but other settings as well). One changes, Compass#rebuild() should be called in order to take the changes into account. Here is an example:

1
2
3
4
5
Compass compass = // create the compass instance
 
compass.getConfig().addClass(NewClass.class);
compass.getConfig().removeMappingByClass(OldClass.class);
compass.rebuild();

From now on, any operations on the new Compass instance will use the updated mappings (and optional settings). Underneath, Compass shuts down the “old Compass instance” gracefully (waiting for current open sessions to be closed).

2 Responses leave one →
  1. 2009 March 20
    nego_oragne permalink

    test

Trackbacks & Pingbacks

  1. KimchyBlog » Blog Archive » Compass 2.1.0 M1 Released

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS