grunt.js指南针任务设置目录问题

时间:2014-10-14 08:32:23

标签: javascript gruntjs

我尝试使用指南针任务使用grunt.js将scss编译为css文件

我的项目文件夹如下:

/my-project
    /myaccount
        /assets
            /css
            /scss
    /node_modules
    Gruntfile.js
    package.json

我的Gruntfile.js是:

module.exports = function(grunt){
    require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        compass: {                  // Task
            dev: {                    // Another target
                options: {
                    sassDir: ['scss'],
                    cssDir: ['css']
                }
            }
        }
    });


    grunt.registerTask('default',   ['compass']);
};

1 个答案:

答案 0 :(得分:0)

试试这个:

compass: {
  options: {
    sassDir: 'myaccount/assets/scss',
    cssDir: 'myaccount/assets/css',
    generatedImagesDir: '.tmp/images/generated',
    imagesDir: 'images',
    javascriptsDir: 'scripts',
    fontsDir: 'fonts',
    importPath: './bower_components',
    httpImagesPath: '/images',
    httpGeneratedImagesPath: '/images/generated',
    httpFontsPath: '/styles/fonts',
    relativeAssets: false,
    assetCacheBuster: false,
    raw: 'Sass::Script::Number.precision = 10\n'
  },
  dist: {
    options: {
      generatedImagesDir: 'images/generated'
    }
  },
  server: {
    options: {
      debugInfo: true
    }
  }
},