Bundle with both CDN and local Resources in CSS - asp.net-mvc-5

bundles.Add(new StyleBundle("~/Resources/styles/css").Include(
"~/Resources/styles/bootstrap-3.1.1.css",
"~/Resources/third-party/ng-table.css",
"~/Resources/styles/site.css"));
I have above kind of bundle in my 'BundleConfig.cs' file.How can I add cdn into above bundle ? Any help would be highly appreciated.
My CDN is :
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" />

Related

ASP.Net Core 6 Hosted Blazor Wasm Not Loading Scripts & CSS Files (When hosted on IIS as Sub Application)

I added these lines in index.html :
<base href="/coolApp/" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
<link href="PublicSite.Web.CLient.styles.css" rel="stylesheet" />
<script src="scripts/bootstrap.min.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
added below code in program.cs:
app.UsePathBase("/coolApp");
iis configuration:
I'm getting below error when hosted in IIS as Sub Application:

Django not loading style file from static directry

I am facing a strange issue with the Django application on my local, the file is available in the static directory.
The following is in the settings.py
STATIC_ROOT = SITE_ROOT + '/static/'
STATIC_URL = '/static/'
this is how I am trying to include style file
<link href="/static/msc.css?v=1.2" rel="stylesheet" type="text/css" />
the following is added in urls.py
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()
The file exist in the static directory, but it is not loading, I am facing a 404 error in console for the URL: http://localhost:8000/static/msc.css?v=1.2
please help me in this regard thanks.
You are not doing things the Django way.
When working with static files in Django
a) you need to use {% load static %} at the very beginning of your template
b) The link to static file is created using the following pattern
<link href="{% static 'path/to/style.css' %}" rel="stylesheet" type="text/css" />
Suppose that I have a directory in my django project static/css/style.css, then
<link href="{% static 'css/style.css' %}" rel="stylesheet" type="text/css" />

How to fix the path of external css in public folder in Express?

Please help me to fix the path to load the external CSS files. I have tried many times, but it does not work out. Here is my category structure:
in the header.ejs, I include the path:
<link rel="stylesheet" type="text/css" href="/style.css" />
I have tried many times, but it does not work
// app.use(express.static(path.join(__dirname + '../../src/web/public/')));
// app.use('*/css',express.static('public/'));
// app.use("/static", express.static(path.resolve(__dirname + "/public/css")));
I keep getting this error:
Refused to apply style from 'localhost:3000/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Assuming the express.static is called within your app.js file (residing in the dist folder) and the public folder is included in the dist folder the following should work:
in your app.ts:
app.use(express.static('public'))
in your html/ejs:
<link rel="stylesheet" type="text/css" href="css/style.css" />
If you intend to keep the public-folder in the src-dir and not include it in your dist-package, you need to adjust the path in your app.ts file:
app.use(express.static(path.join(__dirname, '../../src/web/public')));

How to link css file inside bundle - Symfony 2.8

I generated new bundle and I have styles.css file in following pathsrc/AdminBundle/Resource/public/styles.css. In my base.html.twig file I have link (templates/head.html.twig)
<link href="{{ asset('bundles/adminbundle/css/styles.css') }}" rel="stylesheet" type="text/css" />
But this giving error not found file. Please help.
Files from src/AdminBundle/Resource/public/styles.css are not copied automaticlly to web/bundles
You need to to run command
php app/console assets:install

mod_rewrite .htaccess - Stylesheets mess up

I'm trying to rewrite some URL's on my website, and it works fine, I just have some issues with the stylesheets. All stylesheets works at index.php but not when url's like: localhost:8888/folder/path/(1,2,3,4)
I have my stylesheets in a file where they're listed like this:
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="includes/css/site.css"/>
<link rel="stylesheet" href="includes/css/viewProfile.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="includes/css/viewProvider.css" type="text/css" media="screen" title="no title" charset="utf-8">
Is there a way to fix this with mod_rewrite or how would I fix this?
This is because you use a relative path to the style sheets. Note that the browser sends requests to
localhost:8888/folder/path/includes/css/...
in that case. If the styles always reside in that configuration at the server root, you could simply make the relative URI an absolute one. Or you remove the path portion for CSS files on the server side.

Resources