Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt-contrib-sass compile single file and directory

Tags:

sass

gruntjs

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.

like image 789
lawlesscreation Avatar asked Aug 07 '13 07:08

lawlesscreation


1 Answers

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'}]
  }
}
like image 151
Sindre Sorhus Avatar answered Oct 24 '22 08:10

Sindre Sorhus