Defining an array of only one object in YAML
gruntjs, javascript, yaml
Solution
Brackets are only for in-line lists. Your list of files should look like this:
images:
files:
- expand: true
cwd: '<%= ui %>/img/'
src:
- '**/*.{png,jpg,gif}'
dest: '<%= dist %>/img'
You can test your YAML for correct syntax with an online parser like this one.
Problem
I'm trying to use load-grunt-config to organise better my Grunt tasks. So far I have had no issues with this. Now, I was trying to configure something like imagemin. So, basically this is the structure I'm trying to replicate within YAML: ``` dynamic: { // Another target files: [{ expand: true, // Enable dynamic expansion cwd: 'src/', // Src matches are relative to this path src: ['**/*.{png,jpg,gif}'], // Actual patterns to match dest: 'dist/' // Destination path prefix }] } ``` And this is my attempt: ``` images: files: [ expand: true cwd: '<%= ui %>/img/' src: - '**/*.{png,jpg,gif}' dest: '<%= dist %>/img' ] ``` However, something must be wrong as the plugin isn't able to get the correct data and hence, fails. ``` >> JS-YAML: missed comma between flow collection entries in "grunt/imagemin.yaml" at line 4, column 8: >> cwd: '<%= ui %>/img/' >> ``` Does anyone knows what could be wrong?