Environment tag dosent work? - asp.net-core-mvc

What is required to get the environment tag to work?
<environment names="Staging,Production">
<link type="text/css" rel="stylesheet" href="~/lib/materialize/dist/css/materialize.min.css" media="screen,projection" />
<link type="text/css" rel="stylesheet" href="~/css/Style.css" media="screen,projection" />
</environment>
Its just rendered just as i wrote it in a .cshtml and not filtered based on the Environment i specified.

It seems you need to add #addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" to the file containing the html, or if you follow the setup of a default project add it to _ViewImports.cshtml.
Also make sure you have added Microsoft.AspNetCore.Mvc.TagHelpers to your project.json.

If you use .NET CORE 1.0, namespace changes to "Microsoft.AspNetCore.Mvc.TagHelpers"

I had this issue because I wasn't using app.UseStaticFiles(); in my startup

Related

Add css file to resources but can not read it in Spring MVC 3.1

I download source code from this link
https://www.onlinetutorialspoint.com/spring/spring-mvc-login-form-example.html
https://www.onlinetutorialspoint.com/wp-content/plugins/download-attachments/includes/download.php?id=206
I can run it well and I want to include bootstrap css to project.
In this project they setup config:
<resources mapping="/resources/**" location="/resources/" />
I tried to add bootstrap.css to resources folder and include it in head tag of jsp file.
But it can not read css file.
<link href="<c:url value="/resources/bootstrap.min.css" />" rel="stylesheet">
I added css to /webapp/resources folder.
Here are my project file structure.
What is problem in my source code?
<mvc:resources mapping="/resources/**" location="/resources/" />
this resources folder is placed under the main (main/resources) folder by default. hence, please move bootstrap.min.css file into main/resources.
Finally, I changed spring mvc from 3.x to version 4, it worked.

Is there an advantage of using assets vs not using?

Is there a difference between the two codes below? The reason I'm asking is because when I use the first one the code work as expected but I get a file reference warning at the at the icon in the top-right corner of the PHPStorm in my .blade.php file!
The error is:
File reference problem
Cannot resolve directory plugins
Cannot resolve directory datatables-bs4
Cannot resolve directory css
Cannot resolve directory dataTables.bootstrap4.min.css
"
<link rel="stylesheet" href="/admin/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="{{ asset('admin/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') }}">

unable to link css file in denjucks template file

I am using deno and denjucks as templating engine. in template .html file header section, I am linking my external css file but failed. the code-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- custom css -->
<link rel="stylesheet" href='../static/style.css'>
the file format is -
main
static
style.css
templates
index.html
Bootstrap link is working but custom css link is not working. Please suggest what is wrong.

Visual Studio 2013 removing a part of html document when publishing?

Is it possible to automatically remove a part of an html document when publishing?
For example removing all development script files references and include compiled css or js files instead?
For example:
<!-- remove these-->
<link href="/app/css/animation.css" rel="stylesheet" />
<link href="/app/css/common.loaders.css" rel="stylesheet" />
<link href="/app/css/common.css" rel="stylesheet" />
<!-- include these instead -->
<link href="/app/css/all-files.min.css" rel="stylesheet" />
Thanks
You can use compiler preprocessors like
#{
#if DEBUG
...
#endif
}
or you could use bundles to help you with compression of js files

how to link bootstrap with codeigniter

I need to connect css styles to codegniter using bootstrap
<link rel="stylesheet" type="text/css" href="<?php echo site_url('css/bootstrap.css'); ?>">
Create one Assets folder in root and add JS CSS and images In that folder and add assets files in your page.
<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/bootstrap.css"); ?>">
You should keep all the static files outside application folder.
Suppose you have a folder named static along with application and system folder. So you can keep all your static files in that folder and then link the files as 'static/css/style.css'
create assest folder in root and add assest/css/bootstrap.min.css then add style
<link rel="stylesheet" type="text/css" href="<?php echo site_url('assest/css/bootstrap.css'); ?>">
first of all you create Assets folder and inside create css folder then include the file bootstrap.min.css . below the code include your view and download the bootstrap css.
<link href="<?= base_url("Assets/css/bootstrap.min.css")?>" rel="stylesheet">

Resources