在Meanjs中,添加了新的库.Json不会自动添加到配置文件中
In Meanjs, adding new lib in bower.json not automatically added to the config file
我正在学习Meanjs。我需要为我的项目添加fontaawesome。所以我在wer里加了一个项。Json格式如下:
"dependencies": {
"bootstrap": "~3",
"angular": "~1.2",
"angular-resource": "~1.2",
"angular-mocks": "~1.2",
"angular-cookies": "~1.2",
"angular-animate": "~1.2",
"angular-touch": "~1.2",
"angular-sanitize": "~1.2",
"angular-bootstrap": "~0.11.0",
"angular-ui-utils": "~0.1.1",
"angular-ui-router": "~0.2.10",
"fontawesome": "~4.1.0"
}
并运行' wer install'。软件包下载成功,但fontawesome没有自动链接到我的页面。我应该手动链接这些库吗?
请帮。
您缺少的步骤是在config/env/*.js文件中添加条目。有一个图书馆部分,在那里你可以看到其他图书馆。config/env文件决定了添加到head标签中的链接。
我不知道如何自动添加这些条目
For:"meanjs-version": "0.4.2"
将库的路径添加到:/config/assets/*.js
例子:/config/assets/default.js
module.exports = {
client: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.css',
'public/lib/angular-typewrite/dist/angular-typewrite.css'
],
js: [
'public/lib/angular/angular.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-typewrite/dist/angular-typewrite.js'
]
}
}
}
}
为了自动更新依赖项,我过去使用过wiredp。
npm install --save-dev grunt-wiredep
在你的Gruntfile.js中,你会有一个像这样的块:
grunt.initConfig({
//bunch of tasks in here
clean: {...},
jshint:{...},
//add the following lines
wiredep: {
src: ['<%= yeoman.app %>/index.html', 'you can add', 'other search paths', 'here'],
block: /(([ 't]*)'/'/'s*bower:*('S*))('n|'r|.)*?('/'/'s*endbower)/gi,
replace: {
js: '{{filePath}}',
}
}
});
一旦将其添加为任务,将该任务添加到任务列表
grunt.registerTask('testOrWhateverYoursIsCalled', [
//your other tasks here
'wiredep'
]);
然后在你的。config文件或任何你有大js文件列表的地方添加这个:
//bower:js
//this will get swapped out for your list of bower components
//endbower
路径可能很奇怪,但我认为您可以使用cwd来更改路径。不知道如何做到这一点,只是玩了wiredp来取代东西,它工作了!!
刚刚回答了我关于堆栈的第一个问题,终于!!
也许你应该加上
<link rel="stylesheet" href="bower_components/fontawesome/css/font-awesome.min.css">
到你的index.html
相关文章:
- 在ListView中添加JSON数组中存储的图像-ReactNative
- 添加 json 文件注释
- 在AngularJS中删除和添加JSON中的项目
- 在表中添加JSON元素
- 添加Json数据作为dojogrid的源
- 在json本地存储中添加json对象时出错
- 如何在Javascript中添加JSON属性
- 分组并为多个键添加JSON对象
- 向可动态行添加JSON对象相关链接
- 添加JSON层到一个传单地图
- 如何添加""JSON中的字符
- 在运行时向JSON数组中添加JSON对象
- 在javascript中添加JSON对象到多维数组
- 如何使用javascript或jquery或angularjs为选定的键添加JSON值
- 向JSON对象中添加JSON对象
- 我在哪里添加JSON到谷歌地图Javascript
- 如何添加json没有复制(包括CasperJS代码)
- Javascript列表对象可以'不添加JSON?node . js,重火力点
- 在HTML数据属性上添加JSON是不是不好?
- 在JavaScript/jQuery中添加JSON数组