對於前端構建系統來說相當新穎,我在Yeoman生成的有角度綁定的站點上工作。它採用Gruntfile.js包括bower.json其聲明如下 - 注意,我加入基金會和它的依賴:如何在Bower/Grunt中明確包含Foundation 5子腳本?
{
"name": "mercurysocialclub",
"version": "0.0.0",
"dependencies": {
"angular": "^1.3.0",
"angular-animate": "^1.3.0",
"angular-cookies": "^1.3.0",
"angular-resource": "^1.3.0",
"angular-route": "^1.3.0",
"angular-sanitize": "^1.3.0",
"angular-touch": "^1.3.0",
"foundation": "^5.5.0",
"fastclick": "^1.0.6",
"modernizr": "^2.8.3"
},
"devDependencies": {
"angular-mocks": "^1.3.0"
},
"appPath": "app",
"moduleName": "mercurysocialclubApp"
}
這一切都檢查出來。從終端運行咕嚕--force後生成產生的/app/index.html下面的腳本調用,並出口與串連所有呼叫/dist/vendor.js:
Configuration is now:
concat:
{ generated:
{ files:
[ { dest: '.tmp/concat/scripts/vendor.js',
src:
[ 'bower_components/modernizr/modernizr.js',
'bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-cookies/angular-cookies.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-route/angular-route.js',
'bower_components/angular-sanitize/angular-sanitize.js',
'bower_components/angular-touch/angular-touch.js',
'bower_components/fastclick/lib/fastclick.js',
'bower_components/jquery.cookie/jquery.cookie.js',
'bower_components/jquery-placeholder/jquery.placeholder.js',
'bower_components/foundation/js/foundation.js' ] },
{ dest: '.tmp/concat/scripts/scripts.js',
然而,基金會軌道腳本似乎不包括在內。我無法弄清楚的是,如何顯式地包含一個基礎依賴腳本與bower.json或Gruntfile.js。
該方案並未包括寫正確: http://foundation.zurb.com/forum/posts/21949-compiling-javascript-in-the-gruntfile
而其他地方我嘗試包括任何被覆蓋或咕嚕CONFIGS之外無法訪問bower_components目錄。
任何想法,我怎麼能告訴格朗特/鮑爾在包括腳本:。bower_components /基礎/ JS /基礎/基礎* JS
- = - = - = - = - = -
另外,在這種情況下聲明Foundation初始化也失敗!
<script>
$(document).ready(function(){
$(document).foundation('orbit', 'reflow');
}):
</script>
雖然一切正常,如果我從終端運行此命令的預期:
$(document).foundation('orbit', 'reflow');