Configure grunt-contrib-sass in Yeoman

a 夏天 提交于 2019-12-11 14:52:51

问题


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:


I think there's a problem:

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

and should work.



来源:https://stackoverflow.com/questions/19881958/configure-grunt-contrib-sass-in-yeoman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!