1

Weird behavior, when i try in grunt-contrib-sass make key variable, instead path.

var sourseScssFolder = 'src/scss/*.scss';
var destCssFile = 'src/packed.css';
sass: {
            dist: {
                options: {
                    style: 'nested'
                },
                files: {
                    // Key don't wanna load from variable
                    destCssFile: sourseScssFolder,
                }
            }
        },

After this compiler create file "dest File", instead read from var. How fix this?

Artfaal
  • 11
  • 1

1 Answers1

0

Grunt is being configured using vanilla Javascript. In other words, the issue you are describing is the same as this one: JavaScript set object key by variable

In this particular case, I would do something like this:

var sourseScssFolder = 'src/scss/*.scss';
var destCssFile = 'src/packed.css';
var configuration = {
    sass: {
        dist: {
            options: {
                style: 'nested'
            },
            files: {}
        }
    }
};
configuration.sass.dist.files[destCssFile] = sourseScssFolder;
grunt.initConfig(configuration);
Community
  • 1
  • 1
PeterssonJesper
  • 211
  • 2
  • 2
  • Thx, but all other plugins for grunt clearly understand vanilla js in that case. It little confuse me. – Artfaal Dec 29 '15 at 12:53