Skip to content

Commit

Permalink
Added templateCache
Browse files Browse the repository at this point in the history
  • Loading branch information
nippur72 committed Oct 27, 2015
1 parent 41d6f4f commit 6441eba
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 196 deletions.
21 changes: 21 additions & 0 deletions Test/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

module.exports = function(grunt) {

grunt.initConfig({

htmlConvert: {
options: {
base: '',
prefix: 'Riot.templateCache = (function(){\n\n',
suffix: ' return mytemplate;\n})();\n'
},
mytemplate: {
src: ['elements/**/*.html'],
dest: 'elements/template-cache.js'
},
},

});

grunt.loadNpmTasks('grunt-html-convert');
};
2 changes: 1 addition & 1 deletion Test/Test.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>specRunner.html</StartPageUrl>
<StartPageUrl>index.html</StartPageUrl>
<StartAction>SpecificPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
Expand Down
25 changes: 25 additions & 0 deletions Test/elements/template-cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Riot.templateCache = (function(){

var mytemplate = {};

mytemplate["elements/test-template.html"] = "<test-template-from-url>\n" +
" <div>template from URL</div>\n" +
"</test-template-from-url>";

mytemplate["elements/timer.html"] = "<timer>\n" +
" <style scoped>\n" +
" .bolded {\n" +
" font-weight: bolder;\n" +
" font-size: large;\n" +
" }\n" +
" </style>\n" +
" <div>\n" +
" timer: <span class=\"bolded\">{{ time }}</span><br>\n" +
" trasclusion is '<yield />'<br>\n" +
" <div each=\"{{el in mylist}}\">iterating over array item \"{{el}}\"<br></div>\n" +
" <div>this is from timer.html file!</div>\n" +
" </div>\n" +
"</timer>\n" +
"";
return mytemplate;
})();
1 change: 1 addition & 0 deletions Test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script>
riot.settings.brackets = "{{ }}";
</script>
<script type="text/javascript" src="elements/template-cache.js"></script>
<script type="text/javascript" src="elements/timer.js"></script>
<script type="text/javascript" src="index.js"></script>
</head>
Expand Down
172 changes: 8 additions & 164 deletions Test/specRunner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Test/specRunner.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions riot-ts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ declare module Riot {
}
function registerAll(): void;
var waitingToBeRegistered: Array<Function>;
var templateCache: {};
function registerClass(element: Function): void;
}
declare var riot: Riot.Base;
Expand Down
30 changes: 16 additions & 14 deletions riot-ts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6441eba

Please sign in to comment.