diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Package/[Owner].[Module]s.nuspec b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Package/[Owner].[Module]s.nuspec
index 57071160..64c81a8d 100644
--- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Package/[Owner].[Module]s.nuspec
+++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/Package/[Owner].[Module]s.nuspec
@@ -27,5 +27,6 @@
+
\ No newline at end of file
diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/content/resources.txt b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/content/resources.txt
new file mode 100644
index 00000000..ac84ee50
--- /dev/null
+++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/content/resources.txt
@@ -0,0 +1 @@
+This is the location where static resources for third party libraries should be located ( the third party library assemblies will be included in the /lib folder ). They should be placed in subfolders which match the naming convention of the third party library. When the module package is deployed the static resource subfolders will be extracted under the web root.
\ No newline at end of file
diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/wwwroot/resources.txt b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/wwwroot/resources.txt
index 2542de03..91780f80 100644
--- a/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/wwwroot/resources.txt
+++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Templates/External/wwwroot/resources.txt
@@ -1 +1 @@
-This is the location where static resources such as images or style sheets should be located
\ No newline at end of file
+This is the location where static resources such as images or style sheets for this module will be located. Static assets can be organized in subfolders. When the module package is deployed the assets will be extracted under the web root in a folder that matches the module name.
\ No newline at end of file
diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs
index b1f73543..adce62e9 100644
--- a/Oqtane.Server/Infrastructure/InstallationManager.cs
+++ b/Oqtane.Server/Infrastructure/InstallationManager.cs
@@ -28,7 +28,7 @@ namespace Oqtane.Infrastructure
{
var webRootPath = _environment.WebRootPath;
- var install = UnpackPackages(folders, webRootPath);
+ var install = InstallPackages(folders, webRootPath);
if (install && restart)
{
@@ -36,7 +36,7 @@ namespace Oqtane.Infrastructure
}
}
- public static bool UnpackPackages(string folders, string webRootPath)
+ public static bool InstallPackages(string folders, string webRootPath)
{
bool install = false;
string binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
@@ -44,14 +44,12 @@ namespace Oqtane.Infrastructure
foreach (string folder in folders.Split(','))
{
string sourceFolder = Path.Combine(webRootPath, folder);
-
- // create folder if it does not exist
if (!Directory.Exists(sourceFolder))
{
Directory.CreateDirectory(sourceFolder);
}
- // iterate through packages
+ // iterate through Nuget packages in source folder
foreach (string packagename in Directory.GetFiles(sourceFolder, "*.nupkg"))
{
string name = Path.GetFileNameWithoutExtension(packagename);
@@ -89,29 +87,33 @@ namespace Oqtane.Infrastructure
// deploy to appropriate locations
foreach (ZipArchiveEntry entry in archive.Entries)
{
+ string foldername = Path.GetDirectoryName(entry.FullName).Split('\\')[0];
string filename = Path.GetFileName(entry.FullName);
- switch (Path.GetExtension(filename).ToLower())
+
+ switch (foldername)
{
- case ".pdb":
- case ".dll":
+ case "lib":
if (binFolder != null) entry.ExtractToFile(Path.Combine(binFolder, filename), true);
break;
- case ".png":
- case ".jpg":
- case ".jpeg":
- case ".gif":
- case ".svg":
- case ".js":
- case ".css":
- string entryPath = Utilities.PathCombine(entry.FullName.Replace("wwwroot", name).Split('/'));
- filename = Path.Combine(sourceFolder, entryPath);
+ case "wwwroot":
+ filename = Path.Combine(sourceFolder, Utilities.PathCombine(entry.FullName.Replace("wwwroot", name).Split('/')));
if (!Directory.Exists(Path.GetDirectoryName(filename)))
{
Directory.CreateDirectory(Path.GetDirectoryName(filename));
}
-
entry.ExtractToFile(filename, true);
break;
+ case "content":
+ if (Path.GetDirectoryName(entry.FullName) != "content") // assets must be in subfolders
+ {
+ filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace("content", "").Split('/')));
+ if (!Directory.Exists(Path.GetDirectoryName(filename)))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(filename));
+ }
+ entry.ExtractToFile(filename, true);
+ }
+ break;
}
}
}
diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs
index 34f73ffe..b47cdd4f 100644
--- a/Oqtane.Server/Startup.cs
+++ b/Oqtane.Server/Startup.cs
@@ -163,7 +163,7 @@ namespace Oqtane
services.AddSingleton();
// install any modules or themes ( this needs to occur BEFORE the assemblies are loaded into the app domain )
- InstallationManager.UnpackPackages("Modules,Themes", _webRoot);
+ InstallationManager.InstallPackages("Modules,Themes", _webRoot);
// register transient scoped core services
services.AddTransient();
diff --git a/Oqtane.Server/wwwroot/resources.txt b/Oqtane.Server/wwwroot/resources.txt
new file mode 100644
index 00000000..2542de03
--- /dev/null
+++ b/Oqtane.Server/wwwroot/resources.txt
@@ -0,0 +1 @@
+This is the location where static resources such as images or style sheets should be located
\ No newline at end of file