Created
May 9, 2011 21:13
-
-
Save bchapuis/963433 to your computer and use it in GitHub Desktop.
Dependency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.agimem</groupId> | |
| <artifactId>jRubyHaml</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // read the template file | |
| InputStream stream = getClass().getClassLoader().getResourceAsStream("myFile.haml"); | |
| String template = IOUtils.toString(stream); | |
| // initialize the options | |
| Map<Object, Object> options = new HashMap<Object, Object>(); | |
| options.put("format", "html5"); | |
| // initialize the engine | |
| HamlEngine engine = new HamlEngine(template, options); | |
| // render the template | |
| Map<Object, Object> attributes = new HashMap<Object, Object>(); | |
| attributes.put("foo", new SimpleValue("bar")); | |
| String result = engine.render(attributes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git clone git://github.com/bchapuis/JRubyHaml.git | |
| cd JRubyHaml | |
| mvn clean install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // read the template file | |
| InputStream stream = getClass().getClassLoader().getResourceAsStream("myFile.scss"); | |
| String template = IOUtils.toString(stream); | |
| // initialize the options | |
| Map options = new HashMap(); | |
| options.put("syntax", "scss"); | |
| options.put("style", "compressed"); | |
| List<String> loadPaths = new ArrayList<String>(); | |
| loadPaths.add("compass/stylesheets"); | |
| loadPaths.add("my/stylesheets"); | |
| options.put("load_paths", loadPaths); | |
| // initialize the engine | |
| SassEngine engine = new SassEngine(template, options); | |
| // render the template | |
| String result = engine.render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment