-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propose to remove the template extension restriction for ".rocker.html" #128
Comments
@iceant I'm open to ideas on allowing additional file extensions or conventions. For example, allowing '.js' in the build process to be processed by Rocker. However, the replacing of dots and spaces with "dot" and "space" feels a bit hacky. Could you just rename "app.main.js" to "app_main.js"? Not sure I understand why not being able to rename the file is a huge deal. |
@jjlauer thanks, the reason we want to name the java file for 'app.js' like 'app_dot_js.java' is because we defined a web fragment as a combination of .html + .css + .js, for example, we have a web fragment called 'timeline', it has this file structure: common/timeline.html, common/timeline.css, common/timeline.js. base on rocker's strategy, the .html, .css and .js will be compiled as the same unit 'timeline.java' that could be an issue. To add 'dot' is the design strategy to avoid this issue. RockerBootstrap is good design, we can provide a new implementation of it to use different 'path to class' resolve strategy. But the compiler is the issue to stop us to use different strategy. It's better to remove the restriction for temlate file with '.html' or '.raw' extension. Even better to have a new interface called 'TemplateResolver' wich has 'public String templateNameToClassName(String templateName)', 'public ContentType templateNameToContentType(String templateName)', 'public String templatePathToClassName(String templatePath)' methods. These interfaces that can be used in DefaultRockerBootstrap, TemplateParser and TemplateModel. The user can provide different implementation for it. |
hmm... looking at possibly using rocker for project scaffolding, including yeah
|
oh, man, this extension parsing is just a terrible experience
I'm going to move on to a different templating system, performance doesn't concern me, I was just hoping for the static typing, without a massive "we only do html" experience. |
It would be awesome if Rocker could handle other file types in addition to
So I guess that's not really an option right now. |
I am using rocker as a generic engine for rendering .html, .js files, and generate dynamic sql.
for example, I have a file with path "static/js/app/app.main.js", I want to keep the extension as it is, so we can benefit the IDE features to coding easily.
I have modified the implementation of rocker to generate a source file with path "static/js/app/app_dot_main_dot_js.java" in "generated-sources" directory.
Is it possible to modify the code base to support this feature?
attach the code I modified.
diff.txt
The text was updated successfully, but these errors were encountered: