0

I'm trying to use GruntJS to make some improvements to my workflow - I've been using Compass for a while but I'm wanting to try out Bourbon and so I've been trying to get this working but failing.

I'm getting the following error when I run 'grunt':

ERROR: Cannot find module 'bourbon'

I've installed this through Node using 'npm install' with the following 'package.json' file:

{
    "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"
    }
}

My grunt file looks like this:

module.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

I've also imported the file in the top of my SCSS stylesheets using:

@import 'bourbon';

Not sure what I'm doing wrong here, any help would be greatly appreciated!

Please let me know if you need any more info.

4

2 回答 2

1

您需要错误的包名称。它应该是:

includePaths: require('node-bourbon').includePaths

但是你有:

includePaths: require('bourbon').includePaths
于 2014-03-28T14:56:20.277 回答
0

手动安装 Bourbon:

安装宝石:

$ gem install bourbon

通过生成 bourbon 文件夹将 Bourbon 安装到项目的样式表目录中:

$ bourbon install
于 2014-03-27T12:36:12.340 回答