GruntFile返回[object,Object] [英] GruntFile returns [object, Object]
问题描述
我正在使用基础/ jekyll 样板。
每当我运行grunt时,它只会在我的style.css中返回以下内容: $ b
[对象对象]
它应该已经从基础文件处理scss。
这里是gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
pkg:grunt.file.readJSON('package.json'),
sass:{
options:{
includePaths:[ 'bower_components / foundation / scss']
},
dist:{
options:{
outputStyle:'compressed'
},
files:{
'css / style.css':'scss / style.scss'
}
}
},
手表:{
grunt:{files:['Gruntfile.js']},
sass:{
files:'scss / ** / *。scss',
tasks:['上海社会科学院]
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build',['sass']);
grunt.registerTask('default',['build','watch']);
}
我唯一要做的事情是npm install node-sass。
我运行grunt,并且在我的style.css中唯一的代码是[object,Object]
编辑:ran npm install grunt- sass
,
现在编译好了。
最近 版本 node-sass
错误情况 node-sass
pipes
[object Object]
而不是失败并显示正确的堆栈跟踪。
c $ c> Gruntfile 在减少测试用例中对我很好,因此在运行任务之前验证您的 scss
文件。
另外,使用 npm install更新到最新的
,因为它似乎没有这样的行为(但会抛出正确的错误)。 node-sass / grunt-sass
node-sass -save-dev
I am using a foundation/jekyll boilerplate.
Whenever I run grunt, it only returns the following in my style.css
[object Object]
It should have processed the scss from the foundation files.
Here is the gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
includePaths: ['bower_components/foundation/scss']
},
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'css/style.css': 'scss/style.scss'
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: 'scss/**/*.scss',
tasks: ['sass']
}
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build', ['sass']);
grunt.registerTask('default', ['build','watch']);
}
The only thing I had to do was npm install node-sass. I ran grunt and the only code in my style.css was [object, Object]
edit: ran npm install grunt-sass
,
css now compiles nicely.
It seems that there's an error with recent version of node-sass
where in error situations node-sass
pipes [object Object]
instead of failing and showing a proper stacktrace.
Your Gruntfile
worked fine for me in a reduced test case, so validate your scss
files before running the task.
Also, update to the newest node-sass/grunt-sass
with npm install node-sass -save-dev
, as it doesn't seem to behave that way (but throws the proper error instead).
这篇关于GruntFile返回[object,Object]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!