grunt-sass-globbing 插件结构的问题
Problems with grunt-sass-globbing plug-in structure
我正在尝试将 Dennis Becker 的 grunt-sass-globbing 插件与 libsass 一起使用,因为 libsass 不支持 sass-globbing . https://github.com/DennisBecker/grunt-sass-globbing
我尝试使用开发人员提供的文档设置一个 libsass 项目。
我无法确定文件需要放置的确切位置以及应该如何调用导入。
以下设置会引发此错误:
Running "sass_globbing:files" (sass_globbing) task
Running "sass:app" (sass) task
>> file to import not found or unreadable: layout/**/*
>> Current dir: /Users/dlahay/Documents/Workspaces/SusyLibsass/css/sass/
>> Line 3 Column 9 css/sass/main.scss
文件结构:
css
|_ main.css
|_ sass
|_ layout
|_ _base.scss
|_ typography
|_ _base.scss
|_ _layoutMap.scss
|_ _typographyMap.scss
|_ main.scss
Gruntfile.js
grunt.initConfig({
sass_globbing: {
files: {
'css/sass/_layoutMap.scss': 'css/sass/layout/**/*.scss',
'css/sass/_typographyMap.scss': 'css/sass/typography/**/*.scss',
},
options: {
useSingleQuotes: false
}
},
// Grunt-sass
sass: {
app: {
files: [{
expand: true,
cwd: 'css/sass',
src: ['*.scss'],
dest: 'css',
ext: '.css'
}]
},
options: {
sourceMap: false,
outputStyle: 'nested',
imagePath: "../",
}
},
// Grunt-contrib-watch
watch: {
sass: {
files: ['css/sass/**/*'],
tasks: ['sass']
},
options: {
livereload: true,
spawn: false
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass-globbing');
grunt.registerTask('default', ['sass_globbing', 'sass', 'watch']);
main.scss:
@import "../../bower_components/susy/sass/susy";
@import "layout/**/*";
@import "typography/**/*";
我还在 grunt-sass-globbing 存储库中发布了这个 question/issue。
我已经在 GitHub 知识库网站上回答了这个问题。这只是 Gruntfile.js 配置的问题 - sass_globbing 任务中没有定义目标。
grunt-sass-globbing 的开发者 Dennis Becker 帮助我确定了我的设置中的两个问题:
我没有在 Gruntfile 的 sass_globbing 任务中识别目标:
sass_globbing: {
my_target: {
files: {
'css/sass/_layoutMap.scss': 'css/sass/layout/**/*.scss',
'css/sass/_typographyMap.scss': 'css/sass/typography/**/*.scss',
},
},
options: {
useSingleQuotes: false
}
},
我的main.scss应该在@import中有地图文件的名字:
@import "../../bower_components/susy/sass/susy";
@import "layoutMap";
@import "typographyMap";
现在一切顺利。谢谢,丹尼斯。
我正在尝试将 Dennis Becker 的 grunt-sass-globbing 插件与 libsass 一起使用,因为 libsass 不支持 sass-globbing . https://github.com/DennisBecker/grunt-sass-globbing
我尝试使用开发人员提供的文档设置一个 libsass 项目。
我无法确定文件需要放置的确切位置以及应该如何调用导入。
以下设置会引发此错误:
Running "sass_globbing:files" (sass_globbing) task
Running "sass:app" (sass) task
>> file to import not found or unreadable: layout/**/*
>> Current dir: /Users/dlahay/Documents/Workspaces/SusyLibsass/css/sass/
>> Line 3 Column 9 css/sass/main.scss
文件结构:
css
|_ main.css
|_ sass
|_ layout
|_ _base.scss
|_ typography
|_ _base.scss
|_ _layoutMap.scss
|_ _typographyMap.scss
|_ main.scss
Gruntfile.js
grunt.initConfig({
sass_globbing: {
files: {
'css/sass/_layoutMap.scss': 'css/sass/layout/**/*.scss',
'css/sass/_typographyMap.scss': 'css/sass/typography/**/*.scss',
},
options: {
useSingleQuotes: false
}
},
// Grunt-sass
sass: {
app: {
files: [{
expand: true,
cwd: 'css/sass',
src: ['*.scss'],
dest: 'css',
ext: '.css'
}]
},
options: {
sourceMap: false,
outputStyle: 'nested',
imagePath: "../",
}
},
// Grunt-contrib-watch
watch: {
sass: {
files: ['css/sass/**/*'],
tasks: ['sass']
},
options: {
livereload: true,
spawn: false
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass-globbing');
grunt.registerTask('default', ['sass_globbing', 'sass', 'watch']);
main.scss:
@import "../../bower_components/susy/sass/susy";
@import "layout/**/*";
@import "typography/**/*";
我还在 grunt-sass-globbing 存储库中发布了这个 question/issue。
我已经在 GitHub 知识库网站上回答了这个问题。这只是 Gruntfile.js 配置的问题 - sass_globbing 任务中没有定义目标。
grunt-sass-globbing 的开发者 Dennis Becker 帮助我确定了我的设置中的两个问题:
我没有在 Gruntfile 的 sass_globbing 任务中识别目标:
sass_globbing: { my_target: { files: { 'css/sass/_layoutMap.scss': 'css/sass/layout/**/*.scss', 'css/sass/_typographyMap.scss': 'css/sass/typography/**/*.scss', }, }, options: { useSingleQuotes: false } },
我的main.scss应该在@import中有地图文件的名字:
@import "../../bower_components/susy/sass/susy"; @import "layoutMap"; @import "typographyMap";
现在一切顺利。谢谢,丹尼斯。