Configure grunt-contrib-sass in Yeoman

2019-09-06 19:18发布

As I want to use Bourbon, I'm looking forward to remove compass grunt task and use plain sass task, however for some reason it doesn't seems to compile my scss files.

I have the following directory structure:

yeomanApp/
  app/
    styles/
      css/
      scss/

My Gruntfile.js looks something like this:

...
grunt.initConfig({
  ...
  sass: {
    dist: {
      files: [{
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        src: ['scss/{,*/}*.scss'],
        dest: 'css',
        ext: '.css'
      }]
    }
  },
  ...
});

grunt.loadNpmTasks('grunt-contrib-sass');

grunt.registerTask('server', function (target) {
  if (target === 'dist') {
    return grunt.task.run(['build', 'connect:dist:keepalive']);
  }

  grunt.task.run([
    'clean:server',
    'concurrent:server',
    'sass',
    'autoprefixer',
    'connect:livereload',
    'watch',
  ]);
});
...

When running this task:

$ grunt sass
Running "sass:dist" (sass) task

Done, without errors.

However, my scss files are not compiled into app/styles/css.

What am I missing?

1条回答
看我几分像从前
2楼-- · 2019-09-06 19:38

I think there's a problem:

dest: '<%= yeoman.app %>/styles/css',

and should work.

查看更多
登录 后发表回答