当我使用grunt命令编译除了sass之外的所有任务都工作正常它只是输出注释所有@import部分在foundation.scss内部没有编译。
有什么问题 ?这是我的gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'src/js/*.js',
dest: 'js/script.min.js'
},
dev:{
options:{
beautify: true,
mangle: false,
compress:false,
preserveComments: 'all'
},
src: 'src/js/*.js',
dest: 'js/script.min.js'
}
},
sass: {
dev:{
options:{
outputStyle: 'expanded'
},
files:{
'css/app.css' : 'node_modules/foundation-sites/scss'
}
},
build:{
options:{
outputStyle: 'compressed'
},
files:{
'css/app.css' : 'node_modules/foundation-sites/scss'
}
}
},
watch:{
js: {
files: ['src/js/*.js'],
tasks: ['uglify:dev']
},
css: {
files: ['node_modules/foundation-sites/scss/**/*.scss'],
tasks: ['sass:dev']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
// Default task(s).
grunt.registerTask('default', ['uglify:dev', 'sass:dev']);
grunt.registerTask('build', ['uglify:build', 'sass:build']);
};
这是我的foundation.scss文件:
/**
* Foundation for Sites by ZURB
* Version 6.2.4
* foundation.zurb.com
* Licensed under MIT Open Source
*/
// Sass utilities
@import 'util/util';
// Global variables and styles
@import 'global';
// Components
@import 'grid/grid';
@import 'typography/typography';
@import 'forms/forms';
@import 'components/visibility';
@import 'components/float';
@import 'components/button';
@import 'components/button-group';
@import 'components/accordion-menu';
@import 'components/accordion';
@import 'components/badge';
@import 'components/breadcrumbs';
@import 'components/callout';
@import 'components/close-button';
@import 'components/drilldown';
@import 'components/dropdown-menu';
@import 'components/dropdown';
@import 'components/flex';
@import 'components/flex-video';
@import 'components/label';
@import 'components/media-object';
@import 'components/menu';
@import 'components/menu-icon';
@import 'components/off-canvas';
@import 'components/orbit';
@import 'components/pagination';
@import 'components/progress-bar';
@import 'components/reveal';
@import 'components/slider';
@import 'components/sticky';
@import 'components/switch';
你应该使用foundation watch
来管理构建过程,不是吗?在这里阅读:http://foundation.zurb.com/sites/docs/installation.html
您是否忘记导入Foundation的所有组件,如documentation中所述?
每个组件都有一个导出mixin,它打印出该组件的CSS。如果你对拥有一切都很酷,你只需要一行代码:
@include foundation-everything;