I need a recommendation on how to use bootstrap as template formatting in a Flask app

Asked

Viewed 49 times

0

Hello, this question seems kind of basic but I still haven’t found a consistent answer. I would like to know if, when using Bootstrap as a template formatting in Flaskpy, the best option is via CDN, that is, by attaching the link in the.html file. [...]

CSS only

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

JS, Popper.js, and jQuery

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapc

[...] or should I download the files and attach to the Static folder of the app? In any case I have some performance loss in my app?

A remark: do not want to make CSS changes to the Bootstrap structure, just use the basic formatting available from the framework.

Thank you for your attention!

  • One more by https://answall.com/questions/11753/por-que-coloca-js-css-e-imagens-em-outro-servor and one more https://answall.com/questions/303645/como-devo-trabalhar-rela%C3%A7ao-a-links-do-bootstrap-e-javascript

1 answer

0


The advantage of using CDN is the speed of charging, plus a service prepared to receive thousands of requests. The downside is not being sure what’s on the other side and not being able to define the optimization on your own site. If you prefer to use local file, you can choose the file . min which is lighter than the normal file. On the bootstrap website there is this download option.

  • I got it. In several places I researched it says this very thing, the speed advantage in charging. Anyway, thank you. I will search more about the tip you gave regarding the file . min.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.