2015-10-20 30 views
1

我一直在使用grunt-express來爲我在家中開發的文件提供服務。我最近更改了我的應用程序的結構,並將我的資產文件夾移到我的應用程序文件夾之外grunt-express沒有提供所有基地

的結構看起來像這樣的時刻:

+---project 
| 
+---app 
| +---bower_components 
| +---mainView 
| +---view2 
| +---components 
| \---css 
+---assets 
| +---fonts 
| +---json 
| \---less 
+---node_modules 
| 
\---Gruntfile.js 

在此之前,資產文件夾所在的應用程序文件夾內。 我到我的Gruntfile.js所做的唯一變化是增加資產的文件夾的基礎陣中,像這樣:

express: { 
      all: { 
       options: { 
        port: 9001, 
        hostname: "localhost", 
        bases: ['app', 'assets'] 
       } 
      } 
     } 

然而,只有在應用中的內容被加載:

However, only the content within app is being loaded.

只運行express和express-keepalive會產生與從我的主開發任務運行相同的結果。

我的版本:

"grunt": "^0.4.5", 
"grunt-express": "^1.4.1" 

難道我誤解一些關於使用咕嚕快車或者是一個錯誤嗎?

請告訴我,如果您需要任何更多的信息,並提前致謝。

回答

0

我的第一個猜測是如果你在應用程序文件夾中啓動,將'assets'更改爲'../assets'。

你的Gruntfile.js位於那棵樹上?你能提供完整目錄列表的截圖嗎?從頂部到您的Gruntfile所在的位置。

+0

我的Gruntfile位於項目級別。我有更新我的問題。 – hochas

+0

您是否嘗試解析完整路徑?記得先用'var path = require('path');'來導入路徑模塊。然後將您的基地設置爲'[path.resolve(__ dirname,'app'),path.resolve(__ dirname,'assets')]' – Vot