gruntjs - How to run grunt sass on several directories with wildcard in Drupal 8 -


in drupal 8 project have custom modules inside each of theme have 2 directories scss , css, structure like:

- modules   - custom     - my_module_1       - scss       - css     - my_module_2       - scss       - css - themes   - my_theme     - gruntfile.js 

in gruntfile.js want tell sass go through each custom module , run on scss folder source , css folder should destination.

so far have task following:

  sass: {     prod:{       options: {         sourcemap: false,         outputstyle: 'compressed',         includepaths: ['scss']       },       files: {         '../../modules/custom/my_module_1/css/file1.css': '../../modules/custom/my_module_1/scss/file1.scss',         '../../modules/custom/my_module_1/css/file2.css': '../../modules/custom/my_module_1/scss/file2.scss',         '../../modules/custom/my_module_2/css/file1.css': '../../modules/custom/my_module_2/scss/file1.scss'       }     }   } 

as can see it's redundant, how can make cleaner in 1 generic command (maybe wildcards couldn't figure out yet)

thanks.

just in case looking same answer in future.

i have ended solving expand following way:

sass: {   prod:{     options: {       sourcemap: false,       outputstyle: 'compressed',       includepaths: ['scss']     },     files: {       expand: true,       src: ['../../modules/custom/*/scss/*.scss'],       dest: '/css',       rename: function(dest, src){         var fname = src.substring(src.lastindexof('/'),src.lastindexof('.'));         return src.substring(0, src.lastindexof('/scss')) + dest + fname + '.css';       },       ext: '.css'     }   } } 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -