vulcanize

This commit is contained in:
Luke Pulverenti
2015-06-20 00:48:45 -04:00
parent 2341ce0983
commit 248cb80084
3 changed files with 96 additions and 70 deletions

View File

@@ -272,6 +272,12 @@ namespace MediaBrowser.WebDashboard.Api
return Path.GetExtension(path).EndsWith("html", StringComparison.OrdinalIgnoreCase);
}
private void CopyFile(string src, string dst)
{
Directory.CreateDirectory(Path.GetDirectoryName(dst));
File.Copy(src, dst, true);
}
public async Task<object> Get(GetDashboardPackage request)
{
var path = Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath,
@@ -299,20 +305,24 @@ namespace MediaBrowser.WebDashboard.Api
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
// Overwrite certain files with cordova specific versions
var cordovaVersion = Path.Combine(path, "thirdparty", "cordova", "registrationservices.js");
var cordovaVersion = Path.Combine(path, "cordova", "registrationservices.js");
File.Copy(cordovaVersion, Path.Combine(path, "scripts", "registrationservices.js"), true);
File.Delete(cordovaVersion);
// Delete things that are unneeded in an attempt to keep the output as trim as possible
Directory.Delete(Path.Combine(path, "css", "images", "tour"), true);
Directory.Delete(Path.Combine(path, "thirdparty", "apiclient", "alt"), true);
Directory.Delete(Path.Combine(path, "apiclient", "alt"), true);
File.Delete(Path.Combine(path, "thirdparty", "jquerymobile-1.4.5", "jquery.mobile-1.4.5.min.map"));
Directory.Delete(Path.Combine(path, "bower_components"), true);
// But we do need this
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"));
}
MinifyCssDirectory(Path.Combine(path, "css"));
MinifyJsDirectory(Path.Combine(path, "scripts"));
MinifyJsDirectory(Path.Combine(path, "thirdparty", "apiclient"));
MinifyJsDirectory(Path.Combine(path, "apiclient"));
MinifyJsDirectory(Path.Combine(path, "voice"));
await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion);