简体   繁体   English

弄清楚Rejuicer在做什么

[英]Figure out exactly what Rejuicer is doing

I need some help with Rejuicer. 我需要Rejuicer的帮助。 I just inherited a C# webapplication that uses it and I cannot figure out what exactly is going on. 我只是继承了一个使用它的C#Web应用程序,但无法弄清楚到底发生了什么。

in the global.asmx.cs under Application_Start we are 在Application_Start下的global.asmx.cs中,我们是

OnRequest.ForJs("~/Combined-{0}.js") .Combine .FilesIn("~/js-survey/") .Matching("*.js") .Configure();

I believe this is combining all the *.js in the js-survey/ folder into a single js called Combined-Uniquename.js. 我相信这会将js-survey /文件夹中的所有* .js组合到一个称为Combined-Uniquename.js的js中。 Is this combining the file on the server? 这是在服务器上合并文件吗?

Then in the Master Page it is using "<%# Rejuiced.JsFor("~/Combined-{0}.js") %>" 然后在母版页中使用"<%# Rejuiced.JsFor("~/Combined-{0}.js") %>"

is this retrieving the file from the server? 这是从服务器检索文件吗?

How can I test these? 我该如何测试?

s s

Is this combining the file on the server? 这是在服务器上合并文件吗?

It is dynamically combining the JavaScript files on app startup and storing them in memory. 它在应用程序启动时动态地组合JavaScript文件并将其存储在内存中。 When a request is done to ~/Combined-HASH.js , Rejuicer handles the request and serves the combined files from memory. 当对~/Combined-HASH.js发出请求时,Rejuicer会处理该请求并从内存中提供合并的文件。 This is handled by RejuicerModule . 这由RejuicerModule处理。

The {0} is replaced by a hash of the file. {0}被文件的哈希替换。 It ensures that when any of the files are changed, the cache is invalidated (since the "file name" will be different). 它确保在更改任何文件时,缓存均无效(因为“文件名”将有所不同)。 Rejuiced.JsFor renders a <script> tag with the correct URL including the hash. Rejuiced.JsFor使用正确的URL(包括哈希)呈现<script>标签。

Take a look at the documentation and website (web.archive.org mirror, the site no longer exists) for more information. 查看文档网站 (web.archive.org镜像,该站点不再存在)以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM