lawlesscreation
lawlesscreation

Reputation: 649

Grunt-contrib-sass compile single file and directory

I'm trying to work out how to compile a single file as well as a directory and for the life of me I cannot get it to work.

sass: {
  dev: {
    options: {
      style: 'expanded'
    },
    files: [
    {'style.css': 'style.scss'},
    {
      expand: true,
      cwd: '/scss/',
      src: '*.scss',
      dest: '/css',
      ext: '.css'
    }]
  }
}

This only seems to compile the style.css and ignores the directory.

Because of WordPress' weird requirements, having the style.css file separate (one level up) from the CSS directory is quite common. An example would also be useful for compiling multiple directories too.

Upvotes: 5

Views: 2634

Answers (1)

Sindre Sorhus
Sindre Sorhus

Reputation: 63477

I assumed that to work too. It might be a bug in grunt. Feel free to open a ticket.

You can use multiple targets to work around it in the meantime:

sass: {
  options: {
    style: 'expanded'
  },
  dev: {
    files: [{
      expand: true,
      cwd: '/scss/',
      src: '*.scss',
      dest: '/css',
      ext: '.css'
    }]
  },
  dev2: {
    files: [{'style.css': 'style.scss'}]
  }
}

Upvotes: 8

Related Questions