예제 #1
0
        private void writeScripts(HtmlTag foot)
        {
            // Do this regardless
            foot.Append(_assets.For("FubuDiagnostics.js").ToEmbeddedScriptTag());

            var routeData = _routeWriter.WriteJavascriptRoutes("FubuDiagnostics.routes", _routes);

            foot.Append(routeData);

            var extensionFiles = _assets.JavascriptFiles().Where(x => x.AssemblyName != "FubuMVC.Core");

            if (_runtime.Mode.InDiagnostics())
            {
                var names = _scripts.Union(extensionFiles.Select(x => x.Name.Split('.').Reverse().Take(2).Reverse().Join(".")));
                var links = _tags.BuildScriptTags(names.Select(x => "fubu-diagnostics/" + x));
                links.Each(x => foot.Append(x));
            }
            else
            {
                _scripts.Each(name =>
                {
                    var file = _assets.For(name);
                    foot.Append(file.ToEmbeddedScriptTag());
                });

                extensionFiles.Each(file => foot.Append(file.ToEmbeddedScriptTag()));
            }
        }
        private void writeScripts(HtmlTag foot)
        {
            // Do this regardless
            foot.Append(_assets.For("FubuDiagnostics.js").ToScriptTag(_request));

            var routeData = _routeWriter.WriteJavascriptRoutes("FubuDiagnostics.routes", _routes);

            foot.Append(routeData);

            var extensionFiles = _assets.JavascriptFiles().Where(x => x.AssemblyName != "FubuMVC.Core");

            if (FubuMode.Mode() == "diagnostics")
            {
                var names = _scripts.Union(extensionFiles.Select(x => x.Name));
                var links = _tags.BuildScriptTags(names.Select(x => "fubu-diagnostics/" + x));
                links.Each(x => foot.Append(x));
            }
            else
            {
                _scripts.Each(name =>
                {
                    var file = _assets.For(name);
                    foot.Append(file.ToScriptTag(_request));
                });

                extensionFiles.Each(file => foot.Append(file.ToScriptTag(_request)));
            }
        }