gpt4 book ai didi

javascript - 使用 grunt-sass 编译基础 sass

转载 作者:行者123 更新时间:2023-12-03 05:31:40 24 4
gpt4 key购买 nike

当我使用 grunt 命令编译时,除 sass 之外的所有任务都工作正常,它只是输出 @import 内所有 @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

关于javascript - 使用 grunt-sass 编译基础 sass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40917311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com