Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to bundle style and script files using layout in asp MVC? Here is an example

ID: 645906 • Letter: H

Question

How to bundle style and script files using layout in asp MVC?

Here is an example.

Layout1 uses style and script file for header and footer functionality. Sections are declared.

View1 uses Layout1 . It also contains style and script files in order to make this view work. Layout sections are updated using @section Sectioname.

Is there a way to bundle all styles and script files at View1? Should I bundle only files needed for Layout1 and apply it in layout code and add View1 files in @section?

What is a good way to resolve this issue?

Explanation / Answer

if the scripts and styles that used in view1, will not be used in another views, the best way is to bundle them only at view1, but if they are common scripts and styles that will be used in many views, bundle them at layout.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote