Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7597837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:15:23+00:00 2026-05-30T22:15:23+00:00

I have an existing project and on new pages I’d like to include new

  • 0

I have an existing project and on new pages I’d like to include new versions of JavaScript libraries without breaking other pages if the libraries are not backward compatible.

What is the best way of achieving this? I’d like to be able to set a variable like: useBootStrapCss2 or something similar to use the new libraries.

At the moment the libraries are included by using a shared partial which is included in the main shared layout page (named Assets).

The problem I foresee is, if the variable is set at the top of the view, the variable won’t be in scope inside the shared view so won’t be able to switch to use the correct Assets partial.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:15:25+00:00Added an answer on May 30, 2026 at 10:15 pm

    To be honest I wouldn’t go the route of having variables set to switch versions of script. That will probably get really messy in the long run.

    You have a couple of clean(er) options.

    Create a separate Layout, basically a clone of your first layout, but with the updated scripts. Use this layout for your new pages, while slowly migrating existing pages over.

    This option avoids the headache of conditional logic, but… it now means you have two layout pages to maintain. This may not be a big deal, but if the old layout will live for a long time it might be a bad idea.

    Create a content area on your layout page with default content.

    @if (IsSectionDefined("ScriptReferences")){   
        @RenderSection("ScriptReferences")   
    }   
    else {  
        <script src="blah.js"></script>  
    }
    

    This is a pretty flexible option and allows you to override on a per-page basis. There may be other options, but these are the best I can think of off the top of my head.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, I have a new project, and I've not done anything like it before,
I have an existing project that builds fine using my IDE. I'd like to
I've an existing project in symfony 1.4 For few new static pages, I added
I have an existing project, so I need a solid way of cleaning/checking user
I have an existing project written in Ruby on Rails. It is sort of
I have an existing project that consumes web services. One was added as a
I have an existing project repo which I use for project A, and has
I have a simple task. I have an existing project with a web service
I have an existing Node project sitting in my Dropbox, and when I open
I'm a C#, ASP.NET newbie. Let's say I have an existing C# project (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.