Why does not work method setCssRenamingMap?

93 views
Skip to first unread message

Dis

unread,
Nov 30, 2011, 3:42:11 AM11/30/11
to closure-stylesheets-discuss
Here is my environment, to reproduce the problem.

File "renaming_map.properties":
text=a
red=b
blue=c
title=e
news=d
--------------------------------------------------------------

File "PropRenamingMap.java":
public class PropRenamingMap implements SoyCssRenamingMap {
private Properties properties = new Properties();
public PropRenamingMap() throws IOException {
File file = new File(
"./renaming_map.properties");
InputStream in = new FileInputStream(file);
if (in != null) {
properties.load(in);
}
in.close();
}
@Override
public String get(String key) {
String out = properties.getProperty(key);
return (out == null ? key : out);
}
}
--------------------------------------------------------------
File "test.jsp":
<%
SoyCssRenamingMap props = new PropRenamingMap();
%>
<%=tofu.newRenderer(NewsSoyInfo.WRAPPER).setMsgBundle(msgBundle)
.setCssRenamingMap(props)
.setData(new SoyMapData(NewsSoyInfo.WRAPPER.NEWS,new
SoyListData())).render()%>


as result page contains "full" css name:
news-title,news-text,... but not short name d-e, d-a,...

How to solve this problem?

wit...@gmail.com

unread,
May 30, 2012, 9:55:21 AM5/30/12
to closure-style...@googlegroups.com
Set CssHandlingScheme to CssHandlingScheme.BACKEND_SPECIFIC.

// Bundle the Soy files for your project into a SoyFileSet.
SoyFileSet sfs = new SoyFileSet.Builder().add(
        new File("PATH TO SOY FILE")).setCssHandlingScheme(
                CssHandlingScheme.BACKEND_SPECIFIC).build();

// Compile the template into a SoyTofu object.
// SoyTofu's newRenderer method returns an object that can render any
// template in file set.
SoyTofu tofu = sfs.compileToTofu();

Alexandre Cassimiro Andreani

unread,
Jul 27, 2013, 5:44:52 PM7/27/13
to closure-style...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages