如果您需要更多的信息,请告诉我。
我正在尝试使用GruntJS对我的工作流程进行一些改进-我一直在使用指南针一段时间,但我想尝试波旁威士忌,所以我一直试图让这个工作,但失败了。
当我运行'grunt'时,我得到以下错误:
ERROR: Cannot find module 'bourbon'
我已经通过Node使用'npm install'安装了下面的'包。json文件:
{
"name" : "project",
"description": "description",
"version" : "0.0.1",
"dependencies" : {
"node-sass": "~0.8.4",
"node-bourbon": "~1.0.0",
"grunt": "~0.4.4",
"grunt-contrib-watch": "~0.6.1",
"grunt-sass": "~0.12.0",
"grunt-contrib-uglify": "~0.4.0",
"matchdep": "~0.3.0"
}
}
我的grunt文件看起来像这样:
模块。Exports = function(grunt) {
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.initConfig({
uglify: {
my_target: {
files: {
'assets/js/main.js': ['_/js/scripts.js']
} // files
} // my_target
}, // uglify
sass: {
dist: {
options: {
includePaths: require('bourbon').includePaths,
outputStyle: 'compressed'
},
files: {
'assets/css/main.css': '_/stylesheets/**/*.scss'
}
}
},
watch: {
options: { livereload: true },
grunt: { files: ['gruntfile.js'] },
scripts: {
files: ['_/js/scripts.js'],
tasks: ['uglify']
}, //script
sass: {
files: ['_/stylesheets/**/*.scss'],
tasks: ['sass']
}, //sass
php: {
files: ['**/*.php']
}
} //watch
}) //initConfig
grunt.registerTask('default', 'watch');
} //exports
我还导入了文件在我的SCSS样式表的顶部使用:
@ import波旁威士忌,
不知道我在这里做错了什么,任何帮助都会非常感激!
您需要错误的包名。应该是:
includePaths: require('node-bourbon').includePaths
但是你有:
includePaths: require('bourbon').includePaths
手动安装Bourbon:
安装gem:
$ gem install bourbon
通过生成Bourbon文件夹将Bourbon安装到项目的样式表目录中:
$ bourbon install