mercredi 13 août 2014

CSS-django bootstrap3 - quel est le but de bootstrap_css ? -Débordement de pile


I am reading through the docs for using bootstrap3-django for templates. I do not understand the purpose of {% bootstrap_css %}. I looked at the source code of this tag, but I cannot understand what its purpose is?


In my base.html template, I have:


{% load static from staticfiles %}
{% load bootstrap3 %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>{% block title %}{% endblock %}</title>
{% bootstrap_css %}
<link href="{% static "css/custom.css" %}" rel="stylesheet">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>

<body>
{% block content %}
{% endblock %}


</body>
</html>

Here I have {% bootstrap_css %} and css links to the bootstrap css from its homepage


<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

without this, the page is not using Bootstrap3. so what is the purpose of {% bootstrap_css %} and why to use it?


Thanks




Sometimes it's best to dig into the source. the bootstrap_css templatetag code can be found here. Looks like it embeds the bootstrap.min.css and potentially a theme url into the page.



I am reading through the docs for using bootstrap3-django for templates. I do not understand the purpose of {% bootstrap_css %}. I looked at the source code of this tag, but I cannot understand what its purpose is?


In my base.html template, I have:


{% load static from staticfiles %}
{% load bootstrap3 %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>{% block title %}{% endblock %}</title>
{% bootstrap_css %}
<link href="{% static "css/custom.css" %}" rel="stylesheet">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>

<body>
{% block content %}
{% endblock %}


</body>
</html>

Here I have {% bootstrap_css %} and css links to the bootstrap css from its homepage


<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

without this, the page is not using Bootstrap3. so what is the purpose of {% bootstrap_css %} and why to use it?


Thanks



Sometimes it's best to dig into the source. the bootstrap_css templatetag code can be found here. Looks like it embeds the bootstrap.min.css and potentially a theme url into the page.


0 commentaires:

Enregistrer un commentaire