Skip to content
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

Closed
wants to merge 56 commits into from

Conversation

mvelosop
Copy link
Contributor

@mvelosop 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)

# 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
@sunsided
Copy link

sunsided commented Nov 3, 2019

Heya, any updates?

@stale
Copy link

stale bot commented Jan 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants