2016-12-02 34 views
0

我需要包括jQuery和bootstrap.min.js在我的反應中的應用。現在我通過npm安裝了bootstrap和jQuery。我在我的less文件中導入bootstrap.less,我只需要bootstraps JS和jQuery。參考bootstrap.min.js應用做出反應

問題是;我在我的AJAX應用程序中使用jQuery,並且我不知道在哪裏包含bootstrap.min.js。

我會盡量提供儘可能多的信息儘可能提供幫助。我的主要條目文件是一個App.jsx,它利用來自react-router的所有路由。我的少量文件導入看起來像這樣。

@import "./../../node_modules/bootstrap/less/bootstrap.less"; 

我layout.pug看起來像這樣

doctype html 
html 
    head 
     meta(charset="utf-8") 
     meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no") 
     meta(http-equiv="x-ua-compatible" content="ie=edge") 
     title #{ siteName } Administration 
     link(rel="icon shortcut", href="/favicon.ico", type="image/x-icon") 
     link(rel="stylesheet", href=maincssfile) 
     link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css") 
    body 
     block content 
      h1 Default Content 
     script(src=mainjsfile) 

進出口使用bootstrap3。

回答

0

我對.pug文件並不十分熟悉,但是您應該可以在鏈接引導程序css cdn的地方包含您需要的兩個js文件的每個cdn的鏈接,這就是我們擁有它的方式佈局在我的應用程序的索引html文件中。

+0

是的,這是我最後的手段。我想只使用模塊而不是CDN,但它看起來像我會採取這種方法。 – Jake