2017-04-11 53 views
2

我是网络开发的新手,无法找到明确的答案。在蒸气上使用Bootstrap

是否可以在Swift中使用Bootstrap中的Swift 3?

+0

我想是的,因为引导它只是一个样式表(CSS)的文件,如果在蒸气中,你可以使用CSS扩展名的文件,你应该使用它。 –

+0

我想你是对的。我会检查出来:) –

回答

6

是的,你可以使用Bootstrap。您将:

  • 添加CDN链接到您的模板文件,即.leaf文件,这些文件在Resources/Views/文件夹,或
  • 下载的引导文件和CSS,JS,字体等加入可以被所有页面访问的Public/文件夹。

对于第一个建议,你可以添加CDN链接到您的base.leaf,像这样:

<!DOCTYPE html> 
<html> 
<head> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 
    #import("head") 
</head> 
    <body> 
     #import("body") 
    </body> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
</html> 

对于第二个建议,你可以将这些文件放在这里:

enter image description here

然后访问这样的文件:

<!DOCTYPE html> 
<html> 
<head> 
    <link rel="stylesheet" href="/styles/{CSS-FILE-NAME}"> 
    #import("head") 
</head> 
    <body> 
     #import("body") 
    </body> 
    <script src="/{JS-FILE-NAME}"></script> 
</html>