【发布时间】:2014-08-16 23:23:08
【问题描述】:
我已经用 yeoman 创建了一个 AngularJS 应用程序。现在我想把前端框架从bootstrap切换到foundation。
在我用bower install foundation --save安装基础之后
Grunt 将以下行添加到我的 index.html 文件中。
<link rel="stylesheet" href="bower_components/foundation/css/foundation.css" />
如何强制 grunt 使用 sass 方式。
对于 sass 方式,index.html 未受影响(js 文件除外),但 main.scss 文件包含以下行或类似内容
@import "../bower_components/foundation/scss/foundation"
使用 sass。
这是bower.json 的 Grundfile.js 触发器
watch: {
bower: {
files: ['bower.json'],
tasks: ['wiredep']
},
}
这里是wiredep任务和指南针任务
// Automatically inject Bower components into the app
wiredep: {
options: {
cwd: '<%= yeoman.app %>'
},
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /..\//
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
我不能 100% 确定这是否是相关部分,所以我附上了完整的 Grundfile.js。
【问题讨论】:
标签: sass gruntjs zurb-foundation yeoman bower