0

For some reason grunt-contrib-sass generates a combined .css file instead of multiple .css files. But this only happens when I define the ext option.

File structure:

app/ assets/ stylesheets/ application.web.scss application.mobile.scss application.tablet.scss public/ assets/

Gruntfile.js Config

sass: { default: { options: { compass: false, noCache: true, style: 'expanded' }, files: [{ expand: true, src: 'application.**.scss', dest: 'public/assets', cwd: 'app/assets/stylesheets', ext: '.css' }] } }

The above configuration generates the following:

app/ assets/ stylesheets/ application.web.scss application.mobile.scss application.tablet.scss public/ assets/ application.css

If I remove the ext option completely it generates:

app/ assets/ stylesheets/ application.web.scss application.mobile.scss application.tablet.scss public/ assets/ application.web.scss application.mobile.scss application.tablet.scss

What I want it to generate is:

app/ assets/ stylesheets/ application.web.scss application.mobile.scss application.tablet.scss public/ assets/ application.web.css application.mobile.css application.tablet.css

I know I'm probably overlooking a very basic thing, but I cannot seem to solve this for the life of me XD So any ideas on what I'm doing wrong?

hyounis
  • 4,529
  • 2
  • 18
  • 16
  • You do understand that every client will download every linked CSS file, even if they do not meet the media conditions, right? The user does not benefit from this. – cimmanon Nov 26 '14 at 13:18
  • You do know that compiling SCSS files into multiple files has nothing to do with the linked CSS right? – hyounis Nov 26 '14 at 13:58

1 Answers1

0

Apparently the problem was that the filenames contained multiple dots. And this gets confused with the extension. To fix this I was supposed to use the extDot attribute to define on which dot does the extension start. I found this answer here https://github.com/gruntjs/grunt/pull/863#issuecomment-22015455 which points to the actual documentation here http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

hyounis
  • 4,529
  • 2
  • 18
  • 16