asp.net mvc - How can I implement a theme from bootswatch or wrapbootstrap in an MVC 5 project? -
I'm about to create a new ASP.Net MVC5 web application. I would like to use the theme from the boots watch or wordbootstrap in the application, but can not find a set of instructions on how to do it.
The steps to implement a theme are quite simple to really understand how to do everything together Works, you will need to understand how ASP.net is making available from the MVC 5 template box and how you can customize it for your needs.
Note: If you have a basic understanding of the MVC 5 template work, scroll down the theme.
ASP.NET MVC 5 Template: How it works
It moves through walking how a MVC 5 project What is happening and under the hood? See all the features of the MVC 5 template
-
Select Web > ASP.NET Web Application under the Create a new project templates. Enter a name for your project and click on OK .
-
On the next wizard, select MVC and OK . This will apply to the MVC 5 template.
-
MVC 5 template creates an MVC application that uses Bootstrap to provide responsive design and theme features. Under the hood, 4 files are installed in the template:
bootstrap.css
,bootstrap.min.css
,bootstrap.js
, andBootstrap.min.js
. -
is bundled in your app using the Bootstrap web application. Inspect
View / Share / _Layout.cshtml
and look for@ styles. ("~ / Content / Css ")
and
@ Scripts.Render (" ~ / bundles / bootstrap ") < / Code>
This refers to the bundles set in the two paths
App_Start / BundleConfig.cs
:Add bundles. ("~ / Script / bootstrap.js", "~ / scripts / response .js"); (Include the new scriptbundle ("~ / / bundle / bootstrap"). Bundle Add ("~ / content / bootstrap.css", "~ / content / site.css"); Add (New Style Bundle ("~ / Content / CSS").
-
This is what makes your application possible to run in front of no configuration.
< H1> Apply Bootstrap Themes to ASP.NET MVC 5
This covers how to apply a bootstrap theme to a MVC 5 project by running
- First of all, download the
css
of the subject you want to apply. For this example, I am using Bootswatch'sflatly.bootstrap.css
andflatly.bootstrap.min.css downloaded in the
content
folder. Include code> (Also be sure to include it in the project). -
Open
App_Start / BundleConfig.cs
and replace the following:bundle . Add ("~ / content / bootstrap.css", "~ / content / site.css"); Add (New Style Bundle ("~ / Content / CSS").
bundles to include your new theme. Add ("~ / content / flat / bootstrap.", "~ / Content / site.css"); (Add new style bundle ("~ / content / css").
-
If you are using the default
_Layout.cshtml
included in the MVC 5 template, you can go to step 4 . If not, at the least, add these two lines to your layout:Your
@ script.Renderer (" ~ / bundle / bootstrap ")
-
Now try to run your project now You should see your newly created application using your theme.
resource
For more information, tutorials, tips and Use Twitter Bootstrap with ASP.NET MVC5 with the help of Trix.
Comments
Post a Comment