New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the option to generate the CoreUI template as a set of basic Razor views for ASP.NET Core MVC #379

Open
wants to merge 56 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@mvelosop
Contributor

mvelosop commented Apr 23, 2018

As commented on issue #367, this PR adds the option to build the CoreUI template as a set of basic Razor views for ASP.NET Core MVC, while keeping the files from node_modules under "lib" with the same folder structure as node_modules.

This feature is executed with the new script "build-aspnetcore" in packages.json.

Running the build-aspnetcore script creates two sets on files in the dist folder:

  • A set of html files, similar to the ones created by the build script, but referencing the vendor files from the lib folder and the images from the images folder, following the ASP.NET MVC conventions.
    This set of files should just work, to verify the conversion worked properly.
  • A set of Razor views (.cshtml) similar to the html files, with a few tweaks:
    • Begins with the line @{ Layout = ""; } to bypass the standard layout
    • Adds ~/ to all references to static files
    • Replaces @ for @@ under certain conditions (check aspnetcore-lib.js)
    • Replaces all links href="{page}.html" for asp-route="CoreUI" asp-route-view="{page}" so they work with the following controller:
[Route("CoreUI")]
public class CoreUIController : Controller
{
    [Route("{view=Index}")]
    public IActionResult Index(string view)
    {
        return View(view);
    }
}

Only three files where modified:

  • .eslintignore: added /build and /test because js coding standards are not enforced in these folders (weren't even for the existing code)
  • .gitignore: The PR includes unit and integration tests that required some input files if the file system, so:
    • All files in test-fs/source have to go into source control (all of node_modules files are fakes, most one-liners)
    • All files in test-fs/dest have to be ignored
  • package.json
    • build-aspnetcore script: Builds the set of Razor views
    • test script: Runs all tests
    • Added mocha and should as dev dependencies
    • Set minimum node version to latest LTS: 8.11.1

These are the new files:

  • build/aspnetcore-deploy.js: The main "user interface" function, that calls relevant functions in
  • build/aspnetcore-lib.js: Contains all the functions that do the relevant work
  • test/build/aspnetcore-lib.test.js: All tests for the functions above
  • test/build/aspnetcore-lib.testdata.js: Test data for unit tests
  • test-fs/source/**/*: Test data for integration tests with the file system
  • test-fs/dest/**/*: Integration tests results (expendable)

mvelosop added some commits Apr 15, 2018

Merge branch 'fix/load-module-test' into feature/add-build-aspnetcore
# Conflicts:
#	.gitignore
#	test-fs/source/src/original-html-document.html
#	test-fs/source/src/test-document.html
#	test/fs-source/src/original-html-document.html
@mach37

This comment has been minimized.

mach37 commented Nov 29, 2018

can we get this updated with current core ui please, async partials/actions, and user/role identity views too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment